how to get List Element from a List in CrmScript

lock
push_pin
done
Besvarat
1

Hi,

i have define a new List in my crm.

this List as a name with many ListElement

I want to use this List in my crmscript.

Can you tell me how i can write a function to load this List and print alle the Element from this list in crmscript ?

Thanks for your help

Fabrice

16. jan. 2024 | 03:02 em

Allt Svar (1)

Hi Fabrice,

See this sample script to fill a list box element with the items of an user defined list;

HtmlElement listBoxElement = addHtmlElement(getScreenElementId(screenElementIndex),
  getScreenElementName(screenElementIndex),
  getScreenElementType(screenElementIndex),
  getScreenElementConfig(screenElementIndex));

Integer udListDefinitionId = 1;
Integer currentUserLanguageId = getActiveUser().getValue("language").toInteger();

SearchEngine seUDListItems;
seUDListItems.addField("UDList.UDList_id");
seUDListItems.addField("UDList.name");
seUDListItems.addCriteria("UDList.UDListDefinition_id", "OperatorEquals", udListDefinitionId.toString());
seUDListItems.addCriteria("UDList.deleted", "OperatorEquals", "0");
seUDListItems.addOrder("UDList.rank", true);


for (seUDListItems.execute(); !seUDListItems.eof(); seUDListItems.next())
{
  	listBoxElement.setFieldValue("add", Map().insert("name", seUDListItems.getField("UDList.name").parseSOMultiLanguageString(currentUserLanguageId)).insert("value", seUDListItems.getField("UDList.UDList_id")));
}
16. jan. 2024 | 04:17 em

Lägg till svar