我想在 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;
我也尝试这样做
select forupdate dirPersonName join
dirPartyTable where dirPersonName.RecId == dirPartyTable.RecId
join cust
where dirPartyTable.RecId == cust.Party
&& cust.AccountNum == account;
他选择不同的用户而不是我需要的用户的问题所以我认为选择用户的问题。
代码返回登录用户,我希望使用从模型传递的用户(包含帐号) 这听起来很乱,但也许可以帮助其他用户面对类似的问题,所以我只是出于这个原因发布了这个答案。