A very quick article on how to push a multi-select picklist from CRM to Creator.
Why?
We're trying to create a record in Creator off a button on the CRM Potential/Deal record. The CRM module has a multi-select picklist which will use commas to delimit but one of the options has a comma in its value.
// What I have in CRM: {"My_MultiPicklist":["Option1","Options 2, 3"]} // What Creator understands: FAILS {"My_MultiPicklist":["["Option1","Options 2, 3"]"]}
- // What I have in CRM:
- {"My_MultiPicklist":["Option1","Options 2, 3"]}
- // What Creator understands: FAILS
- {"My_MultiPicklist":["["Option1","Options 2, 3"]"]}
// What Creator understands: FAILS {"My_MultiPicklist":["Option1","Options 2"," 3"]}
- // What Creator understands: FAILS
- {"My_MultiPicklist":["Option1","Options 2"," 3"]}
How?
So the way to push this value over to Creator is by converting the list to a string... notably comma delimited:
// Reading CRM: l_MyMultiPicklist = List:String(); l_MyMultiPicklist.add("Option1"); l_MyMultiPicklist.add("Options 2, 3"); // Push to Creator: m_CrmFields = Map(); m_CrmFields.put("My_MultiPicklist": l_MyMultiPicklist.toString(",")); // Yields ERROR: Failure, Invalid column value \"Options 2, 3\" specified // i.e. Cannot match picklist option in Creator (Options 2 is split from 3)
- // Reading CRM:
- l_MyMultiPicklist = List:String();
- l_MyMultiPicklist.add("Option1");
- l_MyMultiPicklist.add("Options 2, 3");
- // Push to Creator:
- m_CrmFields = Map();
- m_CrmFields.put("My_MultiPicklist": l_MyMultiPicklist.toString(","));
- // Yields ERROR: Failure, Invalid column value \"Options 2, 3\" specified
- // i.e. Cannot match picklist option in Creator (Options 2 is split from 3)
Solution: In the Creator picklist/dropdown options, change any comma to , then in your CRM code to create the record in Creator:
l_MyMultiPicklist = List(); for each r_PicklistOption in r_DealDetails.get("My_MultiPicklist") { v_PicklistOption = r_PicklistOption.trim().replaceAll(",", ",",true); l_MyMultiPicklist.add(v_PicklistOption); } m_CrmFields.put("My_MultiPicklist",l_ProductCategories.toString()); // Yields: SUCCESS: Note the "," will display as a comma in both Creator and CRM.
- l_MyMultiPicklist = List();
- for each r_PicklistOption in r_DealDetails.get("My_MultiPicklist")
- {
- v_PicklistOption = r_PicklistOption.trim().replaceAll(",", ",",true);
- l_MyMultiPicklist.add(v_PicklistOption);
- }
- m_CrmFields.put("My_MultiPicklist",l_ProductCategories.toString());
- // Yields: SUCCESS: Note the "," will display as a comma in both Creator and CRM.