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

hey jesusnava,

yes , you can add sys_id in that and using that you can fetch the value of  field

Example

:var grUser = new GlideRecord('sys_user'); // get printer contact User record grUser.get('PASTE_USER_SYS_ID_HERE'); // Create message to add to the description var msg = current.description+grUser.name;

 The get method can returns the first record so you should always make sure the query is unique to a single record.
 

Example:-   var inc = new GlideRecord('incident');
                  inc.get('number','INC12345');

Also not that the get() function actually returns a boolean to indicate if a record was found or not.
Example:

var gr = new GlideRecord('incident');
var foundit = gr.get()
gs.print('found it = ' + foundit)

Mark correct and helpful if it useful content.

Regards,

Indrajit.

Anil Shewale
Mega Guru

Hi

To achieve this, you can write a BR on CTASK  table each and include this line before using .query() ,

 

For eg:                 

var wf = new GlideRecord('incident');

        wf.setWorkflow(false);

        wf.update();

It will restrict the business rules to get fired.

 

If it help mark helpful or correct 

Thanks and regards

Anil