Add items from MRVS to catalog task Description

ELiv
Tera Contributor

Hi, we have a list of 26 items the customer can select to order from the hardware catalog. Upon submitting the order the fulfiller adds items to backfill into a MRVS. I want all Items added to the MRVS to be added to a single backfill catalog task in the description. Could anyone show me how this could be done?

Thanks!

4 REPLIES 4

Mike_R
Kilo Patron
Kilo Patron

There's a backordered button on the requested item form.

 

Mike_R_0-1669669818471.png

 

Maybe create a flow or business rule that whenever this is checked, automatically create the catalog task. And in that task you can just display the mrvs. Otherwise, if you need to print the mrvs to the description, see this post

https://www.servicenow.com/community/developer-blog/scripting-the-multi-row-variable-set/ba-p/227495...

 

Brad Bowman
Kilo Patron
Kilo Patron

If the Catalog Task doesn't yet exist, add something like this example to the script in that activity, setting the value of task.description.  Otherwise your Run Script in the workflow, or Business rule would have to do a GlideRecord on sc_task to return the correct record, then set the description field and update that record.  The logic is the same either way.  The MRVS is stored as JSON, so you just have to loop through it and grab the variable values that you want.  

var desc = '';
var mrvs = current.variables.network_gear_model_mrvs; //internal name of MRVS
var rowCount = mrvs.getRowCount();
for(var i = 0; i < rowCount; i++){
    var row = mrvs.getRow(i);
    desc += 'Model to order: ' + row.v_mrvs_model_name + '\nQuantity to order: ' + row.v_mrvs_quantity + '\n';
}
task.description = desc;

 

Thanks for the replies! @Brad Bowman  Sorry, I forgot to mention this client is currently using flow designer rather than workflow. Would the favorable action than be to use a business rule? Currently, I set a for each loop to loop through the mrvs but it creates a separate catalog task for each item added to the mrvs, and they prefer to have a single task with all items in the description...

ELiv
Tera Contributor

@Mike_R the fulfiller needs to choose multiple items from the list on the order evaluation task that needs to be backfilled and have those items appear on a single backfill task for completion.