- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 10:31 AM - edited 09-05-2023 11:39 AM
I am working in a workflow. I want to get fee_expiration from a multi row variable set called hard_charge_fees. I am just checking to see if the value of fee_expiration is empty. How do I return all values of fee_expiration?
answer = ifScript();
function ifScript() {
var feeExpValue = [];
var mvrs = JSON.parse(current.variables.hard_charge_fees);
workflow.info('feeExpValue: mvrs: ' + JSON.stringify(current.variables.hard_charge_fees));
for (var i = 0; i < mvrs.length; i++) {
feeExpValue.push(mvrs[i].fee_expiration);
}
if ((feeExpValue != '') || (feeExpValue != 'undefined') || (feeExpValue != null)) {
return 'yes';
}
return 'no';
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 11:53 AM
I'm not following why you would want to do this within an if activity, unless you want to return no if EVERY value of fee_expiration is empty in the MRVS. In any event, this structure works best for retrieving and looping through an MRVS, with some logging to confirm the script is operating correctly:
answer = ifScript();
function ifScript() {
var feeExpValue = [];
var mvrs = current.variables.hard_charge_fees;
var rowCount = mrvs.getRowCount();
for(var i=0; i<rowCount; i++) {
var row = mrvs.getRow(i);
feeExpValue.push(row.fee_expiration.toString());
workflow.info('fee_expiration: mvrs: ' + row.fee_expiration);
}
workflow.info('feeExpValue: ' + feeExpValue.join(','));
if ((feeExpValue != '') || (feeExpValue != 'undefined') || (feeExpValue != null)) {
return 'yes';
}
return 'no';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 11:53 AM
I'm not following why you would want to do this within an if activity, unless you want to return no if EVERY value of fee_expiration is empty in the MRVS. In any event, this structure works best for retrieving and looping through an MRVS, with some logging to confirm the script is operating correctly:
answer = ifScript();
function ifScript() {
var feeExpValue = [];
var mvrs = current.variables.hard_charge_fees;
var rowCount = mrvs.getRowCount();
for(var i=0; i<rowCount; i++) {
var row = mrvs.getRow(i);
feeExpValue.push(row.fee_expiration.toString());
workflow.info('fee_expiration: mvrs: ' + row.fee_expiration);
}
workflow.info('feeExpValue: ' + feeExpValue.join(','));
if ((feeExpValue != '') || (feeExpValue != 'undefined') || (feeExpValue != null)) {
return 'yes';
}
return 'no';
}