business rule condition

Deepika54
Tera Contributor

Hello experts,

 

The incident state is 'on hold' and on hold reason is 'awaiting caller'. if the state value changes to any other thing apart from 'on hold' and on hold reason as 'awaiting caller', i need to trigger a BR like if it moves to 'on hold' and 'awaiting third party' or lets say it moved to in progress i.e any other value apart from on hold and awaiting caller, the BR Should trigger.

 

Can anyone please help me in the condition part. Thanks in advance 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepika54 

try this in script of before update business rule

// Only run on update
if (
    previous.state == 3 && // 3 = On Hold (verify your instance's value)
    previous.hold_reason == 'awaiting_caller' && // 'awaiting_caller' is the value in the dictionary
    (
        current.state != 3 || // State changed from On Hold to something else
        current.hold_reason != 'awaiting_caller' // Or On Hold Reason changed from Awaiting Caller to something else
    )
) {
    // Your business rule logic here
	
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@Deepika54 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

GopikaP
Mega Sage

Hi @Deepika54 , you can try adding the filter conditions like any one of these : 

Screenshot 2025-07-14 155550.pngScreenshot 2025-07-14 155629.png

J Siva
Tera Sage

Hi @Deepika54 
Try the below condition.

JSiva_0-1752489818782.png

 


Regards,
Siva

RathanK
Kilo Guru

Hello @Deepika54 

 

You only need to trigger the BR or you have any specific use case or configuration that should be done after triggering the BR.

 

Based on your use case below is the condition you can refer.

 

Use Before Update BR.
PFA the screenshot.

RathanK_0-1752489205929.pngRathanK_1-1752489252580.png


Below is the script:

(function executeRule(current, previous /*null when async*/ ) {
    var wasAwaitingCaller = previous.state == '3' && previous.hold_reason == 'awaiting_caller';
    var movedAwayFromAwaitingCaller = !(current.state == '3' && current.hold_reason == 'awaiting_caller');
    if (wasAwaitingCaller && movedAwayFromAwaitingCaller) {
        gs.info('Incident moved out of Awaiting Caller status.');
    }
})(current, previous);
 
Regards,
Rathan K
If you found my response helpful, please give it a thumbs-up and designate it as solution accepted to support fellow developers and admins.


Regards,
Rathan K

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepika54 

try this in script of before update business rule

// Only run on update
if (
    previous.state == 3 && // 3 = On Hold (verify your instance's value)
    previous.hold_reason == 'awaiting_caller' && // 'awaiting_caller' is the value in the dictionary
    (
        current.state != 3 || // State changed from On Hold to something else
        current.hold_reason != 'awaiting_caller' // Or On Hold Reason changed from Awaiting Caller to something else
    )
) {
    // Your business rule logic here
	
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader