How to populate of Catalog variable values on Catalog task form

Angshuman3
Mega Guru

I am having a catalog item which is having 3 fields [Name, Location, Contact] which is having its values like [Angshuman , India, E-Mail].

Now I want exact same values with field name to be imported on the Description field on the catalog task. How will this be possible?? If it will be possible using the workflow or we need to create any rule for the same?

 

Thanks & Regards,

Angshuman

1 ACCEPTED SOLUTION

Mihir Mohanta
Kilo Sage

In the catalog task activity of the workflow write down advanced script like

 

task.description ="Name is:" +current.variables.Name+".Product is:"+current.variables.Product ;

 

Use the variable names in place of bold text as per your need

View solution in original post

8 REPLIES 8

SanjivMeher
Kilo Patron
Kilo Patron

Use a business rule on task table which should be an onBefore Insert BR

 

var wn = '';
           var set = new GlideappVariablePoolQuestionSet();
           set.setRequestID(current.request_item);// requested item sys_id
           set.load();
           var vs = set.getFlatQuestions();
           for (var i=0; i < vs.size(); i++) {
               if(vs.get(i).getLabel() != '' &&  JSUtil.notNil(vs.get(i).getDisplayValue()) ) {
                           wn+= vs.get(i).getLabel() + ": " + vs.get(i).getDisplayValue() + "\n";
               }
}

current.description += wn;

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

Hi Sanjiv,

Thanks for the help, can you explain me a bit more, so will this BR run for every request that is created for the particular catalog item because I found you have asked to mention the sys_id of the RITM... so I was having the query.

I want the field values to be populated whenever someone creates a request.

This business rule will be on Catalog Task and should run onBefore and onInsert. So this only runs when a catalog task is created from the RITM. If there are 5 catalog tasks created, this BR will run for all the 5 catalog task to populate the description


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

I am having 2 catalog tasks, and both the catalog tasks should get populated with different field names and values from the catalog item. In that case will this work?