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

Dynamic collection in Xrm.WebApi.online.execute method

$
0
0

Hi, I'm trying to add contacts to a marketing list using javascript, but I can get the collection/array right.

So this works fine,

var parameters = {
List: {
listid: listGUID,
"@odata.type": "Microsoft.Dynamics.CRM.list"
},
Members: [{
contactid: "3e132973-47b4-eb11-8236-00224814b6e3",
"@odata.type": "Microsoft.Dynamics.CRM.contact"
}]
};

But I want the members array to be built previously, but I just don't know how to do it. I thought I might be able to do this but it doesn't work. 

var memberList = '[{contactid: "3e132973-47b4-eb11-8236-00224814b6e3","@odata.type": "Microsoft.Dynamics.CRM.contact"}]'
var parameters = {
List: {
listid: listGUID,
"@odata.type": "Microsoft.Dynamics.CRM.list"
},
Members: memberList
};

So now I'm sure that it's easy to setup, but I just don't know how to do it. Thank you!


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>