- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 12:03 AM
Hi,all
I would like to add a process to insert a record into the description field of an incident in a script.
I understand that I can write the script using the following, but there are two things I would like you to tell me.
1) gr.setValue("A", "B"); ⇐ Please let me know if there is a docs URL that explains this expression. I looked for it, but couldn't find it.
2)I'm not sure what I should put in A and B, so please let me know.
Best Regard
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 01:41 AM
setValue() is a method in GlideRecord() class. Official document is available in ServiceNow's GlideRecord api reference.
setValue(String name, Object value)
Normally a script would do a direct assignment, for example, now_GR.category = value
. However, if in a script the element name is a variable, then now_GR.setValue(elementName, value)
can be used. When setting a value, ensure the data type of the field matches the data type of the value you enter.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 12:41 AM
You can find all the APIs on developers website.Link below
https://developer.servicenow.com/dev.do#!/learn/learning-plans/quebec/new_to_servicenow/app_store_learnv2_scripting_quebec_gliderecord
Kindly mark helpful/correct if this resolved your query.
Regards
Vinayak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 01:41 AM
setValue() is a method in GlideRecord() class. Official document is available in ServiceNow's GlideRecord api reference.
setValue(String name, Object value)
Normally a script would do a direct assignment, for example, now_GR.category = value
. However, if in a script the element name is a variable, then now_GR.setValue(elementName, value)
can be used. When setting a value, ensure the data type of the field matches the data type of the value you enter.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 01:43 AM
Hello
gr.setValue("A", "B"); for this gr.setValue("Field Name", "Backend Value");
Mark my Response as Correct or Helpful, if you find it Appropriate.
Gaurav Shirsat
https://www.linkedin.com/in/gauravshirsat/