I am setting two lookup fields (Contact and Account entity) while creating a custom entity record.
Once the recorded is created I can see Contact lookup is set on the form but not Account.
The Account lookup I am trying to link on custom entity record is related to Contact.
I am using schema names for this purpose and have also tried to create the custom entity record first and then update this with Account record later but it wouldn't have it.
Here is the code:
try
{ //create CR object var Obj= new Object(); Obj.name = "ABC"; Obj.changedescription = "Test Description"; Obj["abc_Account@odata.bind"] = "/accounts("+ accountId +")"; //Doesn't work and no error Obj["abc_Contact@odata.bind"] = "/contacts("+ contactId +")"; //Works Xrm.WebApi.createRecord("abc_entity", Obj).then(function (result) { //get the guid of created record var recordId = result.id; //below code is used to open the created record var windowOptions = { openInNewWindow: false }; //check if XRM.Utility is not null if (Xrm.Utility != null) { //open the entity record Xrm.Utility.openEntityForm("abc_entity", recordId, null, windowOptions); } }, function (error) { Xrm.Utility.alertDialog(error.message); }); } catch (e) { Xrm.Utility.alertDialog(e.message); }
Any suggestions would be welcome.
Thanks
Do you have audit enabled, can you verify if that value is set & clearing out again? May be some plugin or custom WF to clear this?
Did you debug to see if the value being set in the creating entity?
Hi Arun,
Yes, it is strange. Its behaving same with other records too and happening always.
Thanks
Interesting, is this happening for any particular record or always?