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

lock
push_pin
done
Beantwortet
8

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!

11. März 2020 | 12:00 AM

Alle Antworten (8)

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.

11. März 2020 | 12:00 AM

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();
}
11. März 2020 | 12:00 AM
Hello.
I have a follow up question on this one.
In the table UDefField the only reference to a standard list table is the field listTableId as far as I can see.
If I have defined a userdefined field that points to one of the standard entities (ie, associate, sale stage, project status) and get a the item value id, how can I then fetch the item value if the only lookup field I have is the listTableId ? https://docs.superoffice.com/en/database/tables/udeffield.html
18. Mai 2025 | 01:35 PM
Answer to Ummairs question: https://community.superoffice.com/en/technical/forums/api-forums/service-crmscript/get-listitem-by-listid/
11 h, 33 m vor | 11:38 AM

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.

 

11. März 2020 | 12:00 AM

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

 

Thanks!

11. März 2020 | 12:00 AM

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

12. März 2020 | 12:00 AM

ok, Thanks!

12. März 2020 | 12:00 AM

Antwort hinzufügen