multiple records update on setWorkflow(false)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 11:20 AM
Hi
i am trying to update multiple ritm records through workflow.
i am using the below code.
var req = current.request;
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request',req);
gr.orderBy('number');
gr.query();
while(gr.next()){
gr.variable_pool.test_access_created="true";
gr.update();
}
this is updating only one record.but the query is fetching multiple records.
if i add
gr.setWorkflow(false);
before gr.update();
all the records are getting updated perfectly.
can we update the multiple records without making the workflow as false?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 11:24 AM
Hi, not sure if you want to use setWorkflow - it is used to skip running business rules during a gliderecord update.
https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=r_GlideRecord-setWorkFlow_Boolean
Enables or disables the running of business rules that might normally be triggered by subsequent actions. If the e parameter is set to false, an insert/update will not be audited. Auditing only happens when the parameter is set to true for a GlideRecord operation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 11:31 AM
thanks for reply, i do not want to use setWorkflow(false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 11:42 AM
Hi Mohammed,
Ok, did that answer your question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 11:49 AM
no jay, without using setWorkflow(false) i am not able to update multiple records.
