How is update function works in server side script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
How is update function works in server side script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
which update method you are referring?
GlideRecord update?
if yes then it simplys updated the record with the fields you set just before using the update() method
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @praveensnow9984,
- gr.update() (GlideRecord API): Used to save record changes directly to the database.
- c.server.update() / server.update() (Service Portal API): Used to trigger a server-side refresh or pass data from a Service Portal widget's client controller to its server script.
If you find my answer useful, please mark it as helpful and correct. 😊
Regards,
Soham Tipnis
ServiceNow Developer || Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @praveensnow9984 ,
The GlideRecord update() method is used in backend like Business Rules, Script Includes, and Background Scripts. It saves changes made to a record back into the database.
Calling .update() commits those adjustments directly to the ServiceNow database.
for ex :
// Example in a Background Script or Script Include
var gr = new GlideRecord('incident');
if (gr.get('sys_id_of_the_record')) {
gr.short_description = 'Updated via Server Script';
gr.update(); //Commit and trigger system engines
}
Additionally we have c.server.update() : Service Portal Communication -
In Service Portal Widgets, c.server.update() is a client-side controller method that triggers execution of the widget's server-side script.
If my response helped mark as helpful and accept the solution.