How to check changes to in GlideList for all the values in BR

Community Alums
Not applicable

HI Team,

 

Suppose we have a field 'role' of type glide_list. How can we check the changes values in this.

We cannot use Changes To in when to run condition as it will assume that glide_list has just 1 value and this will not work as a glide_list can have more than 1 values. IF it has suppose 2 value and we add a 3rd one, ChangesTo will not work,

 

If we add just 1 value and it has no other values then only it will work

3 ACCEPTED SOLUTIONS

Sandeep Rajput
Tera Patron
Tera Patron

@Community Alums Instead of using Changes To, you should use Changes condition in your BR. You can compare the changes by comparing the current and previous values of the field which you are monitoring for change.

 

Here is an example.

I created a business rule on the incident table and it only triggers when there are any changes on the watchlist field (a Glide List type field). I show a message on form whenever the watchlist changes. 

Screenshot 2024-05-25 at 3.03.15 PM.pngScreenshot 2024-05-25 at 3.04.10 PM.png

This BR runs on update and each time when the watchlist changes (user added or removed from watchlist) the BR gets a callback and it shows the messge.

 

If you wish to compare the current and previous values of the watchlist elements in the script then you can do it by comparing current.watch_list and previous.watch_list.

 

Hope this helps.

 

 

View solution in original post

SN_Learn
Kilo Patron
Kilo Patron

Hi @Community Alums ,

 

Please try the below in 'before' update business rule:

(function executeRule(current, previous /*null when async*/) {

	var gdListPrev = previous.u_affected_cis.split(','); //change it with your GlideList field backend name
	var gdListCurr = current.u_affected_cis.split(','); //change it with your GlideList field backend name

	if(gdListCurr != gdListPrev){
//Write your script here
}
		
})(current, previous);

 

Please mark this response as correct or helpful if it assisted you with your question.

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

View solution in original post

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Community Alums 

 

your right !

 

For this you will need to compare the previous and current values onbefore updated business rule you can make use of for loop and indexOf() function to see if the values have changes.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@Community Alums Instead of using Changes To, you should use Changes condition in your BR. You can compare the changes by comparing the current and previous values of the field which you are monitoring for change.

 

Here is an example.

I created a business rule on the incident table and it only triggers when there are any changes on the watchlist field (a Glide List type field). I show a message on form whenever the watchlist changes. 

Screenshot 2024-05-25 at 3.03.15 PM.pngScreenshot 2024-05-25 at 3.04.10 PM.png

This BR runs on update and each time when the watchlist changes (user added or removed from watchlist) the BR gets a callback and it shows the messge.

 

If you wish to compare the current and previous values of the watchlist elements in the script then you can do it by comparing current.watch_list and previous.watch_list.

 

Hope this helps.

 

 

SN_Learn
Kilo Patron
Kilo Patron

Hi @Community Alums ,

 

Please try the below in 'before' update business rule:

(function executeRule(current, previous /*null when async*/) {

	var gdListPrev = previous.u_affected_cis.split(','); //change it with your GlideList field backend name
	var gdListCurr = current.u_affected_cis.split(','); //change it with your GlideList field backend name

	if(gdListCurr != gdListPrev){
//Write your script here
}
		
})(current, previous);

 

Please mark this response as correct or helpful if it assisted you with your question.

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Community Alums 

 

your right !

 

For this you will need to compare the previous and current values onbefore updated business rule you can make use of for loop and indexOf() function to see if the values have changes.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect