I need to use gr.setworkflow(false) to disable a Business Rule but it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 09:05 AM
Hello experts,
Please I need your help, I was asked to create a UI action called "Reschedule" so that a date field can be updated or corrected.
There is already a BR that at the moment the date is updated, the whole record goes back to "new", this is the BR:
so at the moment dates are moved and ticket saved, the ticket goes back to "new", I created a UI action called "Reschedule" and another Business Rule adding the gr.setworkflow(false) to disable a Business Rule but it is not working:
I created a field for "Reschedule" so that whenever changes to "true" the BR runs
But it is not working, could you please guide me on what I am doing wrong?
Thank you!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 09:21 AM
gr.setworkflow(false) works only if you have specified some database action, for example
var gr = new GlideRecord('incident');
gr.get('sgsdgfdgdfdgdgg'); //returns glide record
gr.state = 3;
gr.setworkflow(false);
gr.update();
The above code says that set state = 3 for incident and disable all business would prevent this update. But in your BR code you have just initialized the GlideRecord
I would suggest use 'gr.setworkflow(false)' in your UI action script instead of business rule
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 10:27 AM
Thank you will try that, in gr.get('sgsgsgsgs'); in there what data do I need to add?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 10:36 AM
The one that I mentioned is for gr.get('sys_id') for getting patricular gilde record
But in your UI action access current object and perform operations
At the end always pair it before your operation
current.setworkflow(false);
current.update(); // or gr.insert()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 10:42 AM
Thank you so in that line gr.get, do I need to add ('sys_id') ? because as you say, this would be for the current record? or I don't need to add that line gr.get.