var existing_collaborators = nlapiGetFieldValues('...
# suitescript
j
var existing_collaborators = nlapiGetFieldValues('custbody_appwrap_approval_collaborator'); var next_approver = nlapiGetFieldValue('employee'); logger.debug(log_title, 'Existing Collaborators:= ' + existing_collaborators.join(',') + ' | Next Approve:= ' + next_approver); // add next approver to list var new_collaborators = []; if (existing_collaborators.length > 0) { new_collaborators = new_collaborators.concat(existing_collaborators); } new_collaborators.push(next_approver); // get the current user var current_user = context.getUser(); if (new_collaborators.indexOf(current_user) == -1) { new_collaborators.push(current_user); } logger.debug(log_title, 'Updated Collaborators:= ' + new_collaborators); nlapiSetFieldValues('custbody_appwrap_approval_collaborator', new_collaborators);