This topic contains 3 replies, has 0 voices, and was last updated by jodieknox 6 years, 10 months ago.
- 
		AuthorPosts
- 
December 20, 2017 at 8:50 am #23244
 jodieknoxWe have tried using a workflow for this but the results are inconsistent. Does anyone have a quick and easy piece of code that can change the custom form based on either approval status or user? Thanks, Jodie 
 This is a cached copy. Click here to see the original post.
- 
December 20, 2017 at 8:58 pm #23245
 k_duncHi Jodie, You could do something like this: Code: 
 function checkUser()
 {
 var role = nlapiGetRole(); // You could also do something similar to check the user etc. too
 if (role == 9999) // Whatever role or user thing you're trying to check
 {
 nlapiSetFieldValue('customform', 111); // Divert user to a different form
 }
 }
 Is this the sort of thing you were after? This is in SuiteScript 1.0.Cheers, Kirk. 
- 
December 21, 2017 at 7:50 am #23246
 mwhite@hgyp.comThis one changes the Sales Order form for a user based on his/her subsidiary. //Read the subsidiary stored in custom record and set that to 'subsidiary' field if(type == 'create'){ var formID = '152' if(nlapiGetContext().getExecutionContext() == 'userinterface' && type == 'create') { switch(nlapiGetSubsidiary()) { case '1': //HG if(nlapiGetLocation() == '43' || nlapiGetLocation() == '44') // Bessie and Mooreland formID = '166'; else if ((nlapiGetLocation() == '62' || nlapiGetLocation() == '103') //Corporate and Midwest && (nlapiGetRole() == '1025' || nlapiGetRole() == '1045') // CSR Group ) formID = '166'; else formID = '152'; break; case '3': //EF formID = '136'; break; case '8': //JAJ formID = '198'; break; case '11': //Imp formID = '206'; break; case '13': //AWC formID = '236'; break; case '14': //NFR formID = '250'; break; } nlapiSetFieldValue('customform', formID, false, true); } } } 
- 
January 15, 2018 at 8:14 am #23247
 jodieknoxThank you! 
- 
		AuthorPosts
You must be logged in to reply to this topic.
