ServiceNow introduction to GlideForm API | ServiceNow Client scripts | ServiceNow JavaScripts - 2

Опубликовано: 09 Октябрь 2024
на канале: TechnoMonk
378
7

ServiceNow introduction to GlideForm API | ServiceNow Client scripts | ServiceNow JavaScripts - 2

Hi There,

I hope you're doing great.

With the participation in the ServiceNow Javascripting Challenge led by [@Gagan Jolly](https://www.servicenow.com/community/..., 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*

1. *clearAllFormMessages*
2. *clearMessages*
3. *clearOptions*
4. *clearValue*
5. *disableAttachments*
6. *enableAttachments*
7. *flash*

*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 :

1. *clearAllFormMessages*
Removes all form messages of any type.
Method Signature : clearAllFormMessages()
Input parameters :
None
Returns :
Void
2. *clearMessages:*
Removes all informational and error messages from the top of the form.
Method Signature: clearMessages()
Input parameters :
None
Returns :
void
3. *clearOptions :*
Removes all options from the choice list.
Method Signature : clearOptions(String fieldName)
Input Parameters :
fieldName == String == Name of the field.
Returns :
void
4. *clearValue:*
Removes any value(s) from the field.
Method Signature : clearValue(String fieldName)
Input parameters :
fieldName == String == Name of the field.
Returns :
void == Method does not return a value
5. *disableAttachments:*
Prevents file attachments from being added.
Method not available for mobile
Method Signature: disableAttachments()
Parameters :
fieldName == String == The field name.
choiceValue == String == The value stored in the database.
choiceLabel == String == The value displayed.
choiceIndex == Number == Order of the choice in the list. The index is into a zero based array.
Returns :
void


*Please be sure to bookmark this article and mark it as Helpful if you thought it helpful.*

Regards,

Amit Gujarathi