Using UDList for setListName on an EventDataDialogField
Hi,
I love using the dialog's in CRMScript, they really do help us to provide very powerful automations. I notice that we can use the setListName to link a List type dialog field to an existing list in SuperOffice (I.E. associate, SaleType etc.), without having to add list items manually. But can this be linked to a list from the UDList table. It seems not to be possible, as there is not parameter for the UDListDefinition_id. If this is not possible, can it be linked to a Custom Object table?
Many thanks,
Trevor
All Replies (2)
Hi Trevor,
Since the list name you are using there is actually referencing a specific MDO provider, you can use the generic 'udlist' mdo provider. List name would then be 'udlist' + ud list definition id
Sample code:
#setLanguageLevel 4;
EventData eventData = getEventData();
String dialogResult = eventData.getInputValue("exampleDialog_button");
Integer udListDefinitionId = 79;
// Only show this dialog if not shown already
if (dialogResult.isEmpty() == true)
{
EventDataDialogDefinition dialog;
dialog.setTitle("Example");
dialog.setType("okcancel");
dialog.setIcon("info");
dialog.setPrefix("exampleDialog_");
// list name is mdo list name
// see https://docs.superoffice.com/en/api/netserver/mdo-providers/reference/index.html
dialog.addList("listField", "UDList", "udlist" + udListDefinitionId.toString(), 0, "", true);
eventData.showDialog(dialog);
}
else if (dialogResult.equalsIgnoreCase("ok") == true)
{
Integer udListId = decodeDBValue(eventData.getInputValue("exampleDialog_listField")).toInteger();
eventData.setValidationMessage("Selected list item ud list id: " + udListId.toString());
// do the things
}