Hi Everyone,
When updating customer details using custcustomerservice class (AIF) in X++, i am getting this error.
Please give me idea to solve the above Error.
Thanks & Regards,
Murali.
*This post is locked for comments
Hi Everyone,
When updating customer details using custcustomerservice class (AIF) in X++, i am getting this error.
Please give me idea to solve the above Error.
Thanks & Regards,
Murali.
*This post is locked for comments
I'm not sure what could help. What looks a bit suspicious is that you put the same time in all parameters:
- Valid from
- Valid to
- Valid as of date
I'm not sure what you expect as a result.
Anyway, perhaps you could look at this old thread, where the same issue is discussed, and also a solution is provided: community.dynamics.com/.../how-to-update-customer-details-in-ax-by-using-aif-in-c
Yes, Nikolaos
please check and advise me.
So that is the exact code that gives you the error?
Hi Nikolaos,
Thanks for your response and please find the below code.
#define.Accountnum("Cust-209")
#define.Name("AX7 Introduction DevelopmentI")
#define.CustGroup("30")
#define.Currency("USD")
CustCustomerService service;
CustCustomer document1;
CustCustomer_CustTable dataObject;
AxdCustomer UpdateCustomer;
CustTable custtable;
String30 id;
Map map;
AifEntityKey key = new AifEntityKey();
AifEntityKeyList entityKeyList = new AifEntityKeyList();
AxdEntityAction entityAction = AxdEntityAction::update;
str getHashCode(String30 _Accountnum)
{
AxdBaseRecordInfo recordInfo;
str documentHash;
Map dataSourceMap = new Map(Types::Integer,Types::Integer);
select custtable
where custtable.AccountNum == _Accountnum;
recordInfo = AxdBaseRecordInfo::newCommon(custtable,1 , dataSourceMap);
documentHash = recordInfo.getRecordHash();
return documentHash;
}
void getDocumentData()
{
document1 = new CustCustomer();
document1.createCustTable();
dataObject = document1.parmCustTable().addNew();
if (entityAction == AxdEntityAction::update)
{
dataObject.parm_DocumentHash(getHashCode(#Accountnum));
}
dataObject.parmAccountNum(#Accountnum);
dataObject.parmCustGroup(#CustGroup);
dataObject.parmCurrency(#Currency);
}
service = CustCustomerService::construct();
UpdateCustomer = new AxdCustomer();
if (entityAction == AxdEntityAction::update)
{
getDocumentData();
}
map = new Map(Types::Integer, Types::Container);
map.insert(fieldnum(CustTable, AccountNum), [#Accountnum]);
key.parmTableId(tablenum(CustTable));
key.parmKeyDataMap(map);
entityKeyList.addEntityKey(key);
UpdateCustomer.createEntityKey(custtable,map);
UpdateCustomer.parmValidAsOfDateTime(DateTimeUtil::utcNow());
UpdateCustomer.parmValidFromDateTime(DateTimeUtil::utcNow());
UpdateCustomer.parmValidTimeStateType(AxdValidTimeStateType::AsOf);
UpdateCustomer.parmValidToDateTime(DateTimeUtil::utcNow());
service.update(entityKeyList, document1);
thanks and regards,
Murali.
Perhaps you could share your code? It's always easier to see what's wrong if it's possible to see the code :)
Do you get the error when selecting the customer, or updating it?
Anyway, perhaps you can use CustCustomer.parmValidAsOfDateTime to provide the required parameter.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156