0

i want to update first , middle and last name in dynamics 365 fo

str  firstname,lastname,middlename;

firstname = subStr(_contracts.fullName(),1,1);
middlename = subStr(_contracts.fullName(),2,2);
lastname = subStr(_contracts.fullName(),3,3);

ttsbegin;
Date currDate = systemDateGet();

select forupdate validtimestate(currDate) * from dirPersonName
             where  dirPerson.RecId== dirPersonName.Person;
if(!dirPersonName.FirstName )
{
    dirPersonName.FirstName = firstname;
}
if(!dirPersonName.LastName )
{
    dirPersonName.LastName = lastname;
}
if(!dirPersonName.MiddleName )
{
    dirPersonName.MiddleName = middlename;
}    
dirPersonName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
dirPersonName.doUpdate();
ttscommit;

i also try to do sth like that

select forupdate dirPersonName join
    dirPartyTable where dirPersonName.RecId == dirPartyTable.RecId
    join cust
    where dirPartyTable.RecId == cust.Party
    && cust.AccountNum == account;

the problem he select different user rather than the user i needs so i thought that the problem in selecting user.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
user4833581
  • 107
  • 1
  • 3
  • 14

0 Answers0