NSSource and UserDefinedFields GetDeleted();

lock
push_pin
done
Besvart
4

Hello Team,

 

I am trying to set up a script that will prevent our users to close sales that have depracated Sources or in our case, "Sale Department" (Custom Field).
After reviewing the documentation, I noticed the Source does not have the GetDeleted() method, and I can't seem to find any information on UserDefinedFields, other than getting them from EventData or mapping them via the Sale Entity.

Do you know how I could go about getting the "Deleted" flag for these two?

Thank you!

#setLanguageLevel 3;

EventData ed = getEventData();

/*Source*/
Integer sourceId = ed.getInputValue("SaleEntity.Source.Id").toInteger(); 
Integer saleId = ed.getInputValue("SaleEntity.SaleId").toInteger();

NSSaleAgent saleAgent;
NSSaleEntity saleEntity = saleAgent.GetSaleEntity(saleId);
NSSource source = saleEntity.GetSource();

String name = source.GetValue();


/*Sale Dpt*/
//“SaleEntity.CustomFields.SuperOffice:3:DisplayText": "1234 SaleDepartment",
//"SaleEntity.CustomFields.SuperOffice:3:DisplayTooltip": "Tolltip",
//"SaleEntity.CustomFields.SuperOffice:3:org": "[I:45]"
String saleAzetsCompany = ed.getInputValue("SaleEntity.UserDefinedFields.SuperOffice:3");

15. jul. 2024 | 12:26 p.m.

Alle Svar (4)

Hello,

Will it be possible to make the GetDeleted() method available for CustomFields and source?

19. sep. 2024 | 08:17 a.m.

Hi Andrei,

With custom tables you can use Search Engine. Examples you can find in 
https://docs.superoffice.com/en/automation/crmscript/searchengine/se-insert-update-delete.html

For a sale you can use DeleteSaleEntity
More about this -> https://docs.superoffice.com/en/sale/howto/crmscript/update.html


If I misunderstood your question, maybe you can give us an example. 



19. sep. 2024 | 12:20 p.m.

Carrier objects of list items like Source (or Category, etc), do not include the deleted flag.

If you want to know if a list item is deleted you could use the GetListItem method of the mdo agent. 

In case of default lists, the list name can be found here: MDO List Providers

In case of a custom/ud list, the list name is 'udlist[UDListDefinitionId]' (without the brackets)

 

 

20. sep. 2024 | 10:33 a.m.
Everything you ever wanted to know about lists...
https://docs.superoffice.com/en/api/netserver/lists/index.html
23. sep. 2024 | 05:54 a.m.

Legg til svar