- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2021 03:40 PM
have a catalog item "Move Users" to move users from one place to another and for various reasons I ended up with a design with "sections" for each user moving on the catalog item. I would like to copy some of the data in each section and add it as a summary row in a multi-row variable set to make it easier on the technician, but I can't figure out how to do that. I've seen several posts that mention how add a row, but I can't figure out the correct syntax to add more than one row. Can anyone help me out?
TIA
Example:
In the catalog item I have 4 sections with the exact same questions and the only difference in the variable names is a number at the end of the field like below:
The next "section" has the same questions but the variable names have "2" at the end instead of "1".
Since scrolling through all the variables on the RITM and SCTASK is not ideal for the technician, I would like to summarize the variables entered by the user into a multi-row variable set to make it easier for the technician to quickly find the information needed. Each row in the MVRS would correlate to one "section", like the screenshot below.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2021 05:02 PM
It's really almost not worth it for only 4 sections, but if your counter variable is named 'counter' then you could try this. Check the workflow context log to see if one of these syntax options woks to return the value of the variable.
var mrvs = current.variables.mrvs_internal_name;
for(var i=1;i<counter;i++){
workflow.info('option 1 ' + current.variables.person_moving_[i];
workflow.info('option 2 ' + current.variables.person_moving_+i;
var newRow = mrvs.addRow();
newRow.person_moving = current.variables.person_moving_[i];
newRow.tag_number = current.variables.tag_number_+i;
}
Otherwise, this isn't too bad.
var mrvs = current.variables.mrvs_internal_name;
if(current.variables.tag_number_1 != ''){
var newRow1 = mrvs.addRow();
newRow1.person_moving = current.variables.person_moving_1;
newRow1.tag_number = current.variables.tag_number_1;
}
if(current.variables.tag_number_2 != ''){
var newRow2 = mrvs.addRow();
newRow2.person_moving = current.variables.person_moving_2;
newRow2.tag_number = current.variables.tag_number_2;
}
if(current.variables.tag_number_3 != ''){
var newRow3 = mrvs.addRow();
newRow3.person_moving = current.variables.person_moving_3;
newRow3.tag_number = current.variables.tag_number_3;
}
if(current.variables.tag_number_4 != ''){
var newRow4 = mrvs.addRow();
newRow4.person_moving = current.variables.person_moving_4;
newRow4.tag_number = current.variables.tag_number_4;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2021 10:16 AM
You are welcome - glad to hear!