copy RITM variables to Catalog task

NiloferS
Tera Contributor

I want to populate catalog item variables on catalog task. these catalog item variables are visible on RITM but not on assosciated catalog task.  

 I wouldnt be able to use slush bucket in work flow/flow designer. Is there any other approach?

6 REPLIES 6

NiloferS
Tera Contributor

I have gone to variables table and made the variables global as suggested. Now the problem is the variables that are hidden on catalog item are visible on ctask. i checked the ui policies and catalog client scripts. nothing i find in it

Hi @NiloferS,

please check below script:

(function executeRule(current, previous /*null when async*/) {
    var ritm = current.request_item.getRefRecord();
    if (ritm) {
        var variables = ritm.variables;
        for (var i in variables) {
            if (variables.hasOwnProperty(i)) {
                var variableName = variables[i].name;
                var variableValue = variables[i].value;
                if (current.variables.hasOwnProperty(variableName)) {
                    current.variables[variableName] = variableValue;
                }
            }
        }
    }
})(current, previous);

Thank you, please make helpful if you accept the solution.