Hi,
Just wondering if anyone can provide advice about how to write to a multiselect user lookup field.
I've tried a number of approaches but none work.
I'm fairly new to Deluge, so would be grateful for any advice. This is a long post, so I really appreciate anyone who takes the time to scan through what I've done and provide suggestions on how to make something work.
------------------------------
Here's method #1:
SubDetails = zoho.crm.getRecordById("Subscriptions",SubId.toLong());
newlist = List();
oldlist = ifnull(SubDetails.get("Observers"),"").toList();
newlist.add(oldlist);
newlist.add({"name":"John XXX","id":"2396546000013610003"});
info newlist;
updateResp = zoho.crm.updateRecord("Subscriptions",SubId.toLong(),{"Observers":{"name":"John XXX","id":"2396546000013610003"}});
info updateResp;
where Subscriptions is a custom module and Observers is a multiselect user lookup field.
The response I get is:
newlist is
[],{"name":"John XXX","id":"2396546000013610003"}
And updateResp indicates success, but no change is made to the record :(
The other problem is that newlist should include the Observers already added to that Subscription, but it does not.
------------------------------
A bit more googling and I was onto method #2:
mp = Map();
mp.put("field0",{"name":"AFS Test Subscription","id":"2396546000024420120"});
mp.put("Observers",{"name":"John XXX","id":"2396546000013610003"});
createResp = zoho.crm.createRecord("Subscriptions X Users",mp);
info mp;
info createResp;
where Subscriptions X Users is the API name for the linking module, and field0 is the API name for the field within that linking module for the Subscription lookup.
The response is:
mp is:
{"field0":{"name":"AFS Test Subscription","id":"2396546000024420120"},"Observers":{"name":"John XXX","id":"2396546000013610003"}}
but unfortunately createResp is
{"status":"failure"}
------------------------------
After reading more docs, I was onto method #3:
createResp = zoho.crm.bulkCreate("Subscriptions X Users",{{"field0":{"name":"AFS Test Subscription","id":"2396546000024420120"},"Observers":{"name":"John XXX","id":"2396546000013610003"}}});
info createResp;
For this method, the response is:
createResp is:
null
------------------------------
If you've made it this far into my post thank you! I hope this leads to a solution that will hopefully help others in future too.