(function execute(inputs, outputs) {
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number);
try {
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number + ' and we are in the Try block and current.u_request_type is ' + current.u_request_type);
var catItem = " sysid"; //sysID of "Database Security - Distributed" cat item
var secFormType = current.u_request_type;
//var secFormType = current.secFormType;
secFormType = secFormType.toString();
var requestedFor;
//requestedFor = requestedFor.toString();
if (secFormType == 'New Hire') {
requestedFor = current.u_multiple_users;
requestedFor = requestedFor.toString();
} else {
requestedFor = current.variables.numusersMultipleUsers;
requestedFor = requestedFor.toString();
}
workflow.scratchpad.requested_for = requestedFor;
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number + ' and we are in the Try block and current.u_request_type is ' + current.u_request_type + ' and requestedFor is ' + requestedFor);
var cartid = gs.generateGUID();
var cart = new sn_sc.CartJS(cartid); ///added parameter to fix the problem stated INC2485728
var request = {
'sysparm_id': catItem,
'sysparm_quantity': '1',
"sysparm_cart_name": cartid, //added parameter to fix the problem stated INC2485728
'variables': {
'secFormType': secFormType, // added by Patrick Latella per INC2250900
'newhireHiringManager': current.variables.newhireHiringManager.toString(),
'transferNewManager': current.variables.transferNewManager.toString(),
'chkModal': current.variables.chkModal.toString(),
'numusersUsersType': current.variables.numusersUsersType.toString(),
'chkBotAccount': current.variables.chkBotAccount.toString(),
'botAccount': current.variables.botAccount.toString(),
'numusersMultipleUsers': current.variables.numusersMultipleUsers.toString(),
'userLandIDs': current.variables.userLandIDs.toString(),
'effDate': current.variables.effDate.toString(),
'chkBotEnabled': current.variables.chkBotEnabled.toString(),
//Set other variables
'local_db_service_account': current.variables.local_db_service_account.toString(),
'open_txt_username': current.variables.open_txt_username.toString(),
'serviceAcctOwner': current.variables.serviceAcctOwner.toString(),
'dbextDatabase': '899b9f1e1bffac90fd762f876e4bcbfc', //System One record on the [u_database_forms] table
'dbextChkNoDatabase': current.variables.dbextChkNoDatabase.toString(),
'dbsecAppName': 'SystemOne',
'dbsecPlatform': 'Sybase',
'dbsecEnvironment': 'PROD',
'dbsecInstance': 'SYB_CADBURY2',
'dbsecDBName': 'gmpriv2dp',
'chcAccessType': current.variables.chcAccessType.toString(),
'dbsecJobFunction': current.variables.dbsecJobFunction.toString(),
'dbsecReasonForAccess': current.variables.dbsecReasonForAccess.toString(),
//'dbsecDescAccess':dbsecDescAccess.toString(),
'dbADGroup': current.variables.dbADGroup.toString(),
'dbsecSameGroupAsDBOwner': current.variables.dbsecSameGroupAsDBOwner.toString(),
'dbsecDBOwner': current.variables.dbsecDBOwner.toString(),
'chkMultipleDatabases': current.variables.chkMultipleDatabases.toString(),
'dbsecMultipleDatabaseInfo': current.variables.dbsecMultipleDatabaseInfo.toString(),
'policy_data_mart': false
}
};
var cartDetails = cart.orderNow(request);
var cartID = cartDetails.request_id;
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number + ' and we are in the Try block and current.u_request_type is ' + current.u_request_type + ' and requestedFor is ' + requestedFor + ' and cartID is ' + cartID);
workflow.scratchpad.req_id = cartID;
} catch (exception) {
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number + ' and we are in the Catch block and current.u_request_type is ' + current.u_request_type + ' and requestedFor is ' + requestedFor + ' and cartID is ' + cartID + ' and the message is ' + ':' + exception.message);
} finally {
gs.log('#### Create Database Security - Distributed RITM activity in SystemOne workflow; current.number is ' + current.number + ' and we are in the Finally block and current.u_request_type is ' + current.u_request_type + ' and requestedFor is ' + requestedFor + ' and cartID is ' + cartID);
}
})(inputs, outputs);