Service-Now Client Side Cheat book
|
Hide/Display variable
|
g_form.setDisplay(<fld>,true/false);
|
|
Disable a field
|
g_form.setDisable(<fld>,true/false);
|
|
Field ReadOnly
|
g_form.setReadOnly(<fld>,true/false);
|
|
Clear Value from Field
|
g_form.clearValue(<fld>);
|
|
Change Label of Field
|
g_form.setLabelOf(<fld>,newlabel);
|
|
Make field mandatory
|
g_form.setMandatory(<fld>,true/false);
|
|
Set Value of Field
|
g_form.setValue(<fld>,value);
|
|
Show error and scroll to field
|
g_form.showErrorBox(<fld>,msg,true/false);
|
|
Add Options to Choice filed
|
g_form.addOption(<fld>,value,label,index);
|
|
Remove Options from Choice field
|
g_form.removeOption(<fld>,value);
|
|
Clear all Options from Choice Field
|
g_form. clearOptions(<fld>);
|
|
Get Reference field Value and Attributes
|
g_form.getReference(<fld>,callbackfunction);
|
|
Flash a particular field
|
g_form.flash(table.name,color,no of flashes)
|
|
Get Integer Value of Field
|
g_form.getIntValue(<fieldname>);
|
|
Get Decimal Value of Field
|
g_form.getDecimalValue(<fieldname>);
|
|
User name of the current user e.g. employee
|
g_user.userName
|
|
First name of the current user e.g. Joe
|
g_user.firstName
|
|
Last name of the current user e.g. Employee
|
g_user.lastName
|
|
sys_id of the current user e.g. 681ccaf9c0a8016400b98a06818d57c7
|
g_user.userID
|
|
if the current user has the role specified, false otherwise. ALWAYS returns true if the user has the 'admin' role.
|
g_user.hasRole(<rolename>)
|
|
if the current user has the exact role specified, false otherwise, regardless of 'admin' role.
|
g_user.hasRoleExactly(<rolename>)
|
|
if the current user has at least one role specified, false otherwise.
|
g_user.hasRoles(<rolename1>,<rolename2>)
|
|
Show Related List
|
g_form.showRelatedList(<relatedlisttablename>)*
|
|
Hide Related List
|
g_form.hideRelatedList(<relatedlisttablename>)
|
|
Show All Related Lists
|
g_form.showRelatedLists();
|
|
Hide All Related Lists
|
g_form.hideRelatedLists();
|
|
Show/Hide a Section
|
g_form.setSectionDisplay(<sectionname>,true/false);
|
|
Get All Sections*
|
g_form.getSectionNames();
|
|
Get All Sections**
|
g_form.getSections();
|
|
Check whether section is Visible
|
g_form.isSectionVisible(<sectionname>);
|
|
Add decorations(not applicable for Catalog Client Scripts)
|
g_form.addDecoration(<fld>,iconname,titleforicon);
|
|
Remove Decorations(not applicable for Catalog Client Scripts)
|
g_form.removeDecoration(<fld>,iconname,titleforicon);
|
|
LiveUpdate running on form*
|
g_form.isLiveUpdating()
|
|
Control a Field
|
g_form.getControl(<fldname>)
|
|
Get an HTML Element from Parameter*
|
g_form.getElement(<parameter>)
|
|
Get HTML element of Option**
|
g_form.getOption(<fieldname>,value);
|
|
Get HTML element of Form
|
g_form.getFormElement()
|
|
Get HTML element of HelpText
|
g_form.getHelpTextControl(<fldname>);
|
|
Submit a form
|
g_form.submit(actionName)
|
|
Save a form
|
g_form.save()
|
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.