This topic contains 4 replies, has 0 voices, and was last updated by Jayadeep Reddy 10 years ago.
-
AuthorPosts
-
October 17, 2014 at 8:46 am #10160
Jayadeep ReddyIs there a way to create a group and associate it with approval process
This is a cached copy. Click here to see the original post. -
October 17, 2014 at 9:30 am #10161
coreyYou can do this by using a Workflow action script to check if a user is a member of group. I use this exact mechanism for quote approvals.
Here is the code I use:
PHP Code:
// Take in a group and checks if the current
// user is in the group. Returns true or false.
var main = function() {
// vars
var group,
user,
filters = [],
columns = [],
searchresults = [];// Get logged in user
user = nlapiGetUser();
//nlapiLogExecution(‘DEBUG’, ‘User ‘, user);
// Get the group parameter.
group = nlapiGetContext().getSetting(‘SCRIPT’, ‘custscript_cxs_cswo_spvrgroup’);
//nlapiLogExecution(‘DEBUG’, ‘Group ‘, group);
// Criteria
filters.push(new nlobjSearchFilter(‘internalid’, null, ‘is’, group));
filters.push(new nlobjSearchFilter(‘internalid’, ‘groupmember’, ‘is’, user));
// Results
columns.push(new nlobjSearchColumn(‘internalid’, ‘groupmember’ )); // Member Idtry {
// Check for user
searchresults = nlapiSearchRecord(‘entitygroup’, null, filters, columns);
// Return true if we have results
if (searchresults){
return ‘T’;
}
} catch (e) {
nlapiLogExecution(‘DEBUG’, e.name, e.message);
return ‘F’;
}
return ‘F’;
} -
October 17, 2014 at 7:45 pm #10162
evan_goldbergI think there may be an even easier way to test group membership in a workflow, using a search for the transition – in the search, have a filter user : group includes , that should match the record if and only if the logged in user is a member of the specified group. I haven’t actually tried it though…
-
October 18, 2014 at 11:29 am #10163
coreyThat would indeed be easier, Evan. That option must not have been around 3 years ago when you told me to create a workflow action script for this
-
November 19, 2014 at 2:57 am #10164
Jayadeep ReddyIt worked,
Thanks a lot corey and evan
-
AuthorPosts
You must be logged in to reply to this topic.