Business Rule is updating previous value on task table

Priya Singh 2 2
Tera Contributor

Hi Team my requirement is that I have to create one catalog item and on that catalog item I don't need to show all variables on portal but I am showing all variables on request and some of the variables on task, now requestor wants to update task variable value on task description.

 

I have written before update BR - 

 

(function executeRule(current, previous /*null when async*/ ) {
 // Add your code here
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.request_item);
set.load();
var vs = set.getFlatQuestions();
var description = '';
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
description = description + vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n";
        }
    }
    current.description = description;
 
Issue is that it's updating previous value not the value which I change currently.
For ex - I changed Priority to high on task variable it will not do anything
But next time I changed it to critical then on task description it will be showing as high 
 
Please advise, thanks in advance



})(current, previous);
5 REPLIES 5

What is nog working? The entire BR, or do you still get the previous values?