how to get value of user-defined list item per crm script

Hi,

 

in SO Windows with vbscripts by Trigger Sales beforeSave, I can get value of user-defined list item:

division = objSO.GetListItem(currentSale.Udef.ByProgId("SuperOffice:1").ListTableId, division).Text

 

but in SO CLoud or SO Web with crm script, with this i get ID of List item back:

devision = ed.getInputValue("SaleEntity.UserDefinedFields.SuperOffice:1");

Is there way to get its ListItem Value back, only with SearchEngine?

 

Thanks!

RE: how to get value of user-defined list item per crm script

i do it with searchEngine:

 

divisionID = ed.getInputValue("SaleEntity.UserDefinedFields.SuperOffice:1");
SearchEngine se;
se.addField("UDList.name");
se.addCriteria("UDList.UDList_id", "OperatorEquals", divisionID);
for (se.execute(); !se.eof(); se.next()){
division = se.getField(0);
}

just, There are many userdfined List in Sales to post their Value in scripts.

By: Jianchun You 11 Mar 2020

RE: how to get value of user-defined list item per crm script

Hi,

It is possible to use NSMDOAgent to get value of selected item. In my case I have an Userdefined list with ID 99

#setLanguageLevel 3;

EventData ed = getEventData();

String listId = ed.getInputValue("SaleEntity.UserDefinedFields.SuperOffice:1").after(":").before("]");

if(listId != "")
{
  NSMDOAgent agent;
  NSMDOListItem item = agent.GetListItem("udlist99", listId.toInteger());
  String listName = item.GetName();
}
By: Michel Krohn-Dale 11 Mar 2020

RE: how to get value of user-defined list item per crm script

Hi Michel,

yes, works, lernt from you the object of NSMDOListItem.

Just i don't need .after(":").before("]") for return ListId, it returns simple the ID of that ListItem.

 

By: Jianchun You 11 Mar 2020

RE: how to get value of user-defined list item per crm script

and by the way, is there select case of vbs in crm script? to get value by diff. case.

 

Thanks!

By: Jianchun You 11 Mar 2020

RE: how to get value of user-defined list item per crm script

You would need to use If statements to accomplish this in CRMScript.

By: Michel Krohn-Dale 12 Mar 2020

RE: how to get value of user-defined list item per crm script

ok, Thanks!

By: Jianchun You 12 Mar 2020