Hi All ,
I am trying to create a customer using Odata with below code :
public bool createCustomer(string targetAxLegalEntity, string custAccount, string custname, string custgrpid)
{
Customer custCustentity = context.CreateTrackedEntityInstance<Customer>();
if(!customerExists(targetAxLegalEntity,custAccount))
{
custCustentity.DataAreaId = targetAxLegalEntity;
custCustentity.CustomerAccount = custAccount;
custCustentity.PartyType = "Organization";
custCustentity.Name = custname;
custCustentity.AddressBooks = "";
custCustentity.AddressCountryRegionId = "USA";
custCustentity.SalesCurrencyCode = "USD";
custCustentity.CustomerGroupId = custgrpid;
if (!SaveChanges())
return false;
logMessageHandler(string.Format("created Customer '{0}' and released to com '{1}'", custCustentity.CustomerAccount, targetAxLegalEntity));
}
return true;
}
This is working fine and I am able to create the Customer.
However when I am trying to create Customer without passing the customer account ,it is not working throwing the error "customer account must be specified".
I have overridden the initvalue method in Customer dataentity ,however it seems this method is not getting called in Odata stack.
Can someone please help me to understand how to use Numbersequence in order to get correct CustAccount.
Thanks,
Gaurav Pandey