ServiceNow introduction to GlideForm API | ServiceNow Client scripts | ServiceNow JavaScripts - 3
TechnoMonk
technologyintroduction to servicenowservicenowservicenow administrator trainingservicenow architectureservicenow basicsservicenow cmdbservicenow communityservicenow demoservicenow how toservicenow itsmservicenow platformservicenow trainingservicenow tutorialservicenow tutorial for beginnersservicenow versionstechtechnomonkwhat is servicenowwhat is servicenow administratorwhat is servicenow platformwhat is servicenow software
ServiceNow introduction to GlideForm API | ServiceNow Client scripts | ServiceNow JavaScripts - 3
Hi There,
I hope you're doing great.
With the participation in the ServiceNow Javascripting Challenge led by @Gagan Jolly , I m learning a lot. I thought I should share my learning on the Now community also
Day 2: ServiceNow Java scripting Challange
Statement of Work :
Write a code using the following methods
- getActionName()
- getBooleanValue(String fieldName)
- getDecimalValue(String fieldName)
- getDisplayValue(String fieldName)
- getHelpTextControl(String fieldName)
- getLabelOf(String fieldName)
- getOption(String fieldName, String choiceValue)
- getReference(String fieldName, Function callBack)
- getRelatedListNames()
- getSectionNames()
- getTableName()
- getUniqueValue()
Solution :
Let's first try to understand what ServiceNow GlideForm API means
GlideForm :
- The GlideForm API provides methods to customize forms.
- Works on the client side only
Lets look into diffrent GlideForm Methods :
- getActionName()
- Returns the most recent action name, or, for a client script, the sys_id of the UI action clicked.
- Method Signature : getActionName()
- Input parameters :
- None
- Returns :
- Void
- getBooleanValue(String fieldName)
- Returns a Boolean value for the specified field.
- Method Signature : getBooleanValue(String fieldName)
- Input parameters :
- fieldName = String =. Name of the field.
- Returns :
- Boolean == Returns false if the field value is false or undefined; otherwise returns true.
- getActionName()
- Returns the most recent action name, or, for a client script, the sys_id of the UI action clicked.
- Method Signature : getActionName()
- Input parameters :
- None
- Returns :
- Void
- getLabelOf()
- Returns the plain text value of the field label.
- Method Signature : getLabelOf()
- Input parameters :
- fieldName =⇒ String =⇒ The field name
- Returns :
- String =⇒. The label text.
- getOption()
- Returns the option element for a selected box named fieldName where choiceValue matches the option value.
- Method signature : getOption(String fieldName, String choiceValue)
- Input parameters :
- fieldName =⇒. String =⇒ Name of the field.
- choiceValue =⇒ String =⇒ Value of the option.
- Return :
- HTMLElement =⇒ The HTMLElement for the option.
- getReference()
- Returns the GlideRecord for a specified field.
- If a callback function is present, this routine runs asynchronously.
- Method signature : getReference(String fieldName, Function callBack)
- Input parameters :
- fieldName =⇒ String =⇒ Name of the field.
- callBack =⇒ Function =⇒ Name of the call back function.
- Returns :
- GlideRecord =⇒ GlideRecord object for the specified field.
- getRelatedListNames()
- Returns an array of related lists from the current form in the order in which they appear on that form.
- Method signature :
- Input parameters :
- void
- Returns :
- Array =⇒ Array of related lists from the current form in the order in which they appear on that form.
- getSectionNames()
- Returns all section names, whether visible or not.
- Method signature : getSectionNames()
- Input parameters :
- Void
- Returns :
- Array of strings =⇒ The section names.
- getTableName()
- Returns the name of the table to which this record belongs.
- Method signature : getTableName()
- Input parameter :
- void
- Returns
- String =⇒ Name of the table
- getUniqueValue()
- Returns the sys_id of the record displayed in the form.
- Method signature : getUniqueValue()
- Input parameters :
- void
- Returns :
- String record sys_id
Please be sure to bookmark this article and mark it as Helpful if you thought it helpful.
Regards,
Amit Gujarathi ... https://www.youtube.com/watch?v=MG_ozuhlgpI
2022-12-20
0.0 LBC
Copyrighted (contact publisher)
53127761 Bytes