Announcements
Hi, Issue related Dynamics 365 CRM Web API using JavaScript. I am facing an issue while creating Or updating any Activity Type entity's record with any custom lookup attribute. E.g. (Phone Call Or any custom activity type entity). It looks like a problem within the activities only. Is it known issue ?
Here is the code:
var entity = {}; entity["new_account@odata.bind"] = "/accounts(XXA19CDD-XXXX-XXXX-XXXX-6C3BE5A8B2XX)"; entity.subject = "API Phone Call";
entity.description = "Test";
entity["regardingobjectid_account@odata.bind"] = "/accounts(XXA19CDD-XXXX-XXXX-XXXX-6C3BE5A8B2XX)";
After removing the below line the code is working absolutely perfect. entity["usb_account@odata.bind"] = "/accounts(XXA19CDD-XXXX-XXXX-XXXX-6C3BE5A8B2XX)";
Error Details: "An undeclared property 'usb_account' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values."
Highly appreciated for any potential input. Thanks...
*This post is locked for comments
Hi to all,
For clarifying this issue; you have to put the relation name especially on the ACTIVITY ENTITIES even if your custom lookup is connected to only one entity type. (opposite to Regarding fields)
e.g.
entity["usb_account@odata.bind"] = "/accounts(XXA19CDD-XXXX-XXXX-XXXX-6C3BE5A8B2XX)";
should be
entity["usb_account_PhoneCall@odata.bind"] = "/accounts(XXA19CDD-XXXX-XXXX-XXXX-6C3BE5A8B2XX)"; (or you can replace with your entityname like _Task or _Appointment etc.) (Thanks to Rawish Kumar)
Hi Goutam,
Thanks for your input. Yes I have checked and schema name which is absolutely correct. Please see the correct scenario once: Only custom lookup attribute on any activity type entity.
Thank you so much for your valuable input Martijn. But issue is only related to "custom lookup attributes" on any Activity Type Entity.
Hi Satish,
I am not sure your lookup schema name is correct or not. Seems "usb_account" shuoud be the lookup schema name.
Here I am giving one sample applicable for account entity.
I am giving you sample example by which you can validate . I am assigning primary contact I'd field of account entity.
var account= new Object();
account["primarycontactid@odata.bind"] = "/contacts(XXXXXXX-45FC-XXXX-XXXX-XXXXXXXX)"; //Primary Contact
You need to check whether your code is allign with this.
Hope this helps.
I just had to figure this out myself recently and wrote blog post for my own personal archive:
[View:http://www.oak3.org/crm/creating-activity-crm-webapi/:750:50]
The trick is in the activity parties.
{ "description" : "Lorem ipsem", "directioncode" : true, "leftvoicemail": false, "regardingobjectid_account@odata.bind" : "/accounts(EA82D93B-CFD9-E711-812D-E0071B6C2F31)", "subject" : "lorem ipsem", "phonecall_activity_parties" : [ { "partyid_systemuser@odata.bind" : "/systemusers(5549B1A7-A7CD-4047-84CC-64BA1FF4756F)", "participationtypemask" : 1 }, { "partyid_contact@odata.bind" : "/contacts(4F2D083E-D3D8-E711-812C-E0071B6C2F31)", "participationtypemask" : 2 }] }
Hi
I am using Web API V8.2 and schema and all does not matters however i have checked all permutation and combinations. The issue is specific to custom lookup fields on any Activity Type entity.
Thanks
Hi Satish,
I am not sure your lookup schema name is correct or not. Seems "usb_account" shuoud be the lookup schema name.
Here I am giving one sample applicable for account entity.
I am giving you sample example by which you can validate . I am assigning primary contact I'd field of account entity.
var account= new Object();
account["primarycontactid@odata.bind"] = "/contacts(XXXXXXX-45FC-XXXX-XXXX-XXXXXXXX)"; //Primary Contact
You need to check whether your code is allign with this.
Hope this helps.
Seems to be a similar problem here that can maybe help you.
André Arnaud de Cal...
294,002
Super User 2025 Season 1
Martin Dráb
232,852
Most Valuable Professional
nmaenpaa
101,158
Moderator