S.
NO Method Name Method Description Syntax
1 GlideForm - Adds an icon on a field's g_form.addDecoration('caller_id', 'icon-star',
addDecoration(String label. 'preferred member');
fieldName, String icon,
String title)
2 GlideForm - Displays the specified error g_form.addErrorMessage('This is an error');
addErrorMessage(String message at the top of the
message) form.
3 GlideForm - Displays a floating form g_form.addFormMessage('info message','info');
addFormMessage(String message at the top of the g_form.addFormMessage('warning
message, String type, form detail section. The message','warning');
Object options) message does not cover g_form.addFormMessage('error
UI actions. message','error');
g_form.addFormMessage('info2
message','info');
g_form.addFormMessage('warning2
message','warning');
g_form.addFormMessage('error2
message','error');
g_form.addFormMessage('Would you like to
reassign this to yourself?', 'info', {buttons:
[{label: "Assign to me", actionName:
"assign_to_me"}], meta: {'userId':
'46d44a23a9fe19810012d100cca80666'}});
4 GlideForm - Adds the specified g_form.addInfoMessage('The top five fields
addInfoMessage(String informational message in this form are mandatory');
message) to the top of the form.
5 GlideForm - Adds a choice to the end g_form.addOption('priority', '6', '6 - Really
addOption(String of a choice list field. Low');
fieldName, String
choiceValue, String
choiceLabel)
6 GlideForm - Adds a choice to the list g_form.addOption('priority', '2.5', '2.5 -
addOption(String field at the position Moderately High', 3);
fieldName, String specified.
choiceValue, String Note: Duplicate list labels
choiceLabel, Number are not supported in
choiceIndex) Service Portal. For
example, items with label
text matching another
label are ignored and not
added to the list.
7 GlideForm - Removes all informational g_form.clearMessages();
clearMessages() and error messages from
the top of the form.
8 GlideForm - Removes all form g_form.clearAllFormMessages();
clearAllFormMessages() messages of any type.
9 GlideForm - Removes all form g_form.clearFormMessages('error');
clearFormMessages(Strin messages of a given type.
g type)
10
Client Script Client Script Client Script
Example 1 Example 2
Name For eg:1 Name For eg:2 Name For eg:3
addDecoration function onLoad() {
//Type appropriate
comment here, and
begin script below
g_form.addDecoration('c
aller_id', 'icon-star', 'Mark
as Favorite', 'color-blue');
g_form.addDecoration('a
ssignment_group', ' icon-
user-group');
}
Example 3