Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

How to pass retrieved lookup field value to Web API create record field value

$
0
0

Hi Guy,

I have used CRM Rest Builder to get these retrieve lookup field and also create a record with a lookup field,

Retrieve Opportunity,

var _opportunityid_value = result["_opportunityid_value"];
var _opportunityid_value_formatted = result["_opportunityid_value@OData.Community.Display.V1.FormattedValue"];
var _opportunityid_value_lookuplogicalname = result["_opportunityid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];

Create a record with opportunity lookup field filled with above retrieved opportunity,

var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = _opportunityid_value; // GUID of the lookup id
lookupValue[0].name = _opportunityid_value_formatted; // Name of the lookup
lookupValue[0].entityType = _opportunityid_value_lookuplogicalname; //Entity Type of the lookup entity

)

entity["bin_opportunity@odata.bind"] = "/opportunities(lookupValue[0].id)";

But this gives me the following error,

')' or ',' expected at position 12 in '(lookupValue[0].id)'.

eventhough I tried with ( ) it doesn't work. Can you guys please tell me what I am doing wrong? 

Thank you in advance.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images