Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Gel function

dipesh1
Kilo Contributor

Hi All

1)When I use code like this what does it essentially mean?

2)What are these "sys_display" , "sys_uniqueVaule" ? are there any more of them? can I get a link of there description?

  gel('sys_display.ecc_agent').value = Name;

    sysId = gel('sys_uniqueValue').value;

Thanks

2 REPLIES 2

edwin_munoz
Mega Guru

Hello Diplesh,



gel is a shortcut for document.getElementById (Docs of the function Document.getElementById() - Web API Interfaces | MDN)



sys_display.ecc_agent is the value for the id attribute of an element in the DOM. Same goes to sys_uniqueValue


.



You can use DOM inspector to get the exact id of the element you want to match.



EDIT: sys_uniqueValue is the id for an element that contains the sys_id of the current form



so you could use the following code to get the sys_id of the current record:


var sysid_gel = gel('sys_uniqueValue');


var sysid = sysid_gel.value;




sys_display.ecc_agent is most likely a field in the form




Thanks


When an id is prefixed by "sys_display", it is usually a reference field.