I need to use gr.setworkflow(false) to disable a Business Rule but it is not working

jesusnava
Giga Expert

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:

find_real_file.png

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:

find_real_file.png

I created a field for "Reschedule" so that whenever changes to "true" the BR runs

find_real_file.png

But it is not working, could you please guide me on what I am doing wrong?

Thank you!

6 REPLIES 6

Vikram Reddy
Giga Guru
Hi jesusnava,
 
 

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

 

Thank you will try that, in gr.get('sgsgsgsgs'); in there what data do I need to add?

 

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()

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.