Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

Posted on by Microsoft Employee

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...

  • Suggested answer
    Seren S Profile Picture
    Seren S 400 on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    Thank you so much for your valuable input Martijn. But issue is only related to "custom lookup attributes" on any Activity Type Entity.  

  • Suggested answer
    gdas Profile Picture
    gdas 50,083 on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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.

  • Suggested answer
    M.T. Eikelenboom Profile Picture
    M.T. Eikelenboom 5,241 on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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
            }]
    }


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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

  • Suggested answer
    gdas Profile Picture
    gdas 50,083 on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Web API using JavaScript - Issue while creating/updating any Activity Type entity's record with any custom lookup attribute.

    Seems to be a similar problem here that can maybe help you.

     https://community.dynamics.com/crm/f/117/t/203648 

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans