Syntax meaning in business rule

Souvick6917
Tera Contributor

Hi Team, 

I have a small query on one of the syntax used in Business rule

For reference: if(!current.reason_state){

gs.addErrorMessage(gs.getMessage('Enter a refusal reason,please complete the field "reason for refusal"'));
        current.setAbortAction(true);
}
Please explain the meaning of if(!current.reason_state)
The business rule is running on a customised table with a field reason_state.
 
Thanks in Advance
Souvick
2 ACCEPTED SOLUTIONS

Meloper
Kilo Sage

It is checking if it is empty or no value.
! is checking for the opposite

 

so if current record reason state is empty or false write the error message

View solution in original post

Dr Atul G- LNG
Tera Patron
Tera Patron

Mean current record reason_state field has any value or not , like we have on Inc , is RFC is filed or not.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

3 REPLIES 3

Meloper
Kilo Sage

It is checking if it is empty or no value.
! is checking for the opposite

 

so if current record reason state is empty or false write the error message

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Souvick6917 

 

My understanding say it is for Boolean value, yes / NO to find out.

 

https://www.codecademy.com/forum_questions/5410613b631fe9b5d000245c

 

The ! is the not operator, so it means if “not false” which means true or if “not true” which means false.

 

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Dr Atul G- LNG
Tera Patron
Tera Patron

Mean current record reason_state field has any value or not , like we have on Inc , is RFC is filed or not.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************