What is the meaning of !current.comments.changes() ?

Amit Rao
Giga Expert

Hello Experts,

In my instance one of BR there is condition 'current.watch_list.changes() && !current.comments.changes()'
I understand that changes()  is GlideElement method.
I want to know what is the meaning of !current.comments.changes() 
Does it mean current comments changes or not changes?
And why we put (exclamation) before current.anyField.changes() ?

Help will be appreciated 🙂 

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi,

Whenever you want to negate a condition, you use ! before the condition.

In your case, !current.comments.changes() means comments NOT changing.

the BR will work only when watch list changes but no comments added.

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

View solution in original post

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Hi Amit,

It would mean 'Comments' does not change. Adding an '!' would negate the condition.

So, the above would function only if the

comments for current record does not change &

watchlist changes

 

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

! is the NOT operator. Using it in any such condition reverses the condition

For eg

if i have to check whether x is not equal to 5, i can to it as

x !=5 OR !(x==5)

Both will work the same.

 

In your example it is checking for comments NOT changing.

 

Hope this helps.

-Anurag

-Anurag

asifnoor
Kilo Patron

Hi,

Whenever you want to negate a condition, you use ! before the condition.

In your case, !current.comments.changes() means comments NOT changing.

the BR will work only when watch list changes but no comments added.

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP