How to copy/capture the variables and variable set responses to catalog task description

bandideena12
Tera Contributor

Hi team, I must copy/capture all the variables including variable sets variables into the catalog task description (REQ->RITM->CATALOG Task) once the catalog item is created and TASK Short description should = catalog item Short description using a flow designer. Please help me, waiting for a solution.

4 REPLIES 4

Hemanth M1
Giga Sage
Giga Sage

Hi @bandideena12 ,

 

You have variable and variable set information on the catalog task aswell(Variable section) , why do you wanna copy again??

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Yes, we have variable and variable set information on the catalog task (Variable section) but the client needs them in the description field too. So I am struggling with that.......

Hi @bandideena12 ,

 

ok, Create a on after Business Rule on sc_task table with below logic

 

   var result = " ";
    var now_GR = new GlideRecord('sc_req_item');
    if (now_GR.get(current.request_item)) {
        var variables = now_GR.variables.getElements();
        for (var i = 0; i < variables.length; i++) {
            var question = variables[i].getQuestion();
            result = result + "\n" + question.getLabel() + ":" + question.getValue();
        }
    }
    current.description = result;
    current.update();

Result:

Example

HemanthM1_0-1704383681155.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Sorry, correction in question..... all variables need to copy/capture/pass to the task (service task) description field not to catalog task. Thank you and please provide the solution.