Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How to set lookup field in custom activity using API request?

Posted on by 5

I cant set lookup fields in any activity using API request.

I have no problem setting any of the party list fields. 

I have no problem setting a lookup field in any entity that is not an Activity entity. 

Here is the sample code:

var data ={
"new_name" : test1,
"new_text" : text, 
"new_test@odata.bind" : "/new_tests("+ guid +")" 
}
Xrm.WebApi.createRecord("new_activity_test", data).then(
function success(result) {
 console.log("id: " +result.id);
},
function (error) {
console.log(error);
}
);

I tried using CRM REST Builder, but i get the same error. Tested it both on premise and online v9.

  • Kaloyan Profile Picture
    Kaloyan 5 on at
    RE: How to set lookup field in custom activity using API request?

    If I use:

       "regardingobjectid_new_test@odata.bind" : "/new_tests("+ guid +")"

    the record is set in regarding so I guess the problem is somewhere in the custom lookup fields.

    I also tried with OOB entities, like setting an Account lookup in the phonecall. But i get the same error.

  • Kaloyan Profile Picture
    Kaloyan 5 on at
    RE: How to set lookup field in custom activity using API request?

    This is the error details:

    VM7508:33 POST https://"organization"/api/data/v9.1/new_activity_tests 400

    global.ashx?ver=-484496092:6870 Uncaught Error: parameter is not passed or parameter is nNull or undefined

  • RE: How to set lookup field in custom activity using API request?

    Can you please provide more details on error message

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans