Approval request in orderguide which to be dynamically based custom field value

Ashish Das
Tera Contributor

Hi All,

 

I have an orderguide which contains 4 catalogitems . When i select 2 catalogitem suppose apple ipad3 and apple iphone 6s and then go to choose option. In that section there is a field called portfolio which is a reference field that refers to a custom table if you see in pictures. When a new record created an approval required from the group which is mentioned in that record. A workflow got triggered when orderguide is requested and every time a approval request goes to a particular approval group which is mentioned in the script section of approval group activity in that workflow. But we need an additional approval request to go to the group which is mentioned in approval group field in portfolio table records.

 

For example:-If you see in the pictures suppose I select ipad3 and iphone 6s in Describeneeds Section and on choose Option section i select client server record which comes from a custom table called portfolio and then i submit request. One approval will go as usual but one additional approval also should go to service desk group as mentioned in the record of the custom table. Approval request to be triggered from the script of approvalgroup activity of Workflow.

 

var appGrpId;
var requestType = current.variables.req_type;
if (requestType == "80f2c56edb2bba00c276f3b31d961977" || requestType == '33e0f7ccdbd083001ecdfb971d96198b')
{
if(current.variables.u_portfolio.u_approval_group != '')
{
appGrpId = current.variables.u_portfolio.u_approval_group.toString();

appGrpId.getValue(u_approval_group);
}
answer.push(appGrpId);
}

Also I tried this script in workflow script of approval group activity but it is not working . Could you please suggest me any solution to achieve this ?

 

Thank You

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

The first thing to change is to remove this line, which will stop the script from running as u_approval_group is undefined and is otherwise not needed

appGrpId.getValue(u_approval_group);

If it's still not working, you'll have to add some logs to the script to see what is happening.  In a Workflow script you can do this like

workflow.info('Request type= ' + requestType);

Add this line before the if statement to confirm if the value assigned to this script variable satisfies the if condition.  Do the same for u_approval_group.