How can I create a workflow for multiple items in an order guide using approval and fulfillment groups in a customized table

nomadie
Kilo Expert

Hi Experts, I am stuck with generating 1 dynamic workflow to work on my order guide with at least 30 items. Each items has different approvers and fulfillers that we've managed using a customized tables.

On the Approval Table
Item #1: Cat Item: AD Access; Approval: User's Manager
Item #2: Cat Item: Email Access; Approval: None

On the Fulfiller Table
Item #1: Cat Item: AD Access; Fulfiller: Helpdesk
Item #2: Cat Item: Email Access; Fulfiller: Messaging

I am really a noob in terms of Order Guide more on scripting so appreciate any assistance will be appreciated. Thanks.

1 ACCEPTED SOLUTION

For the approval I use the following script:

answer = [];
var gr = new GlideRecord("u_generic_workflow_variables");
gr.addQuery("u_catalog_itemsLIKE" + current.cat_item);
gr.addQuery("u_role", current.variables.role);
gr.query();
if (gr.next()) {
	var approvers = gr.u_approvers.split(',');
	for (i = 0; i < approvers.length; i++) {
		answer.push(approvers[i]);
	}
}

I have a role variable on my forms so they choose various roles which have different approvers but you wouldn't need that.

For the fulfillment task you need to select advanced on the catalog task activity and in the script section add something like this

var gr = new GlideRecord("u_generic_workflow_variables");
gr.addQuery("u_catalog_itemsLIKE" + current.cat_item);
gr.addQuery("u_role", current.variables.role);
gr.query();
if (gr.next()) {
	task.assignment_group = gr.u_fulfillment_group; //This change the variable here to your column name.
}

I hope this is making sense. Let me know if you need further explaination.

Regards,

Michael.

 

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information. 

View solution in original post

4 REPLIES 4

michaelmcaliste
Kilo Guru

Hi nomadie,

This sounds like something that I have set up in our environment. I built a single generic workflow and made a custom table that I gave access to the staff members that need to update the approvers etc. so I didn't need to keep changing workflows every time they wanted to change approvers. I actually now use the same generic workflow for most of my catalog items. 

Do achieve this I created a table with the first column being a reference field pointing to the sc_cat_item table to select the catalog item. The second column was a list of 1st level approvers. The third column was a list of 2nd level approvers (we needed two rounds of approvals). You might need to add a true/false column to say whether to send an approval to the user's manager or have no approver depending on your requirements.

Then finally I had another reference column that pointed the the sys_template table. I then created a template for the task I wanted to create and chose that for each row in my table. This allowed me to have different tasks created for each catalog item (you might just want to point it to the sys_user_group table if you just want to set the fulfiller group.

Then my workflow looks up the catalog item, pulls the record from the table and uses the various pieces of data at various steps of the workflow. Does this sound similar to what you are trying to achieve? If so let me know and I can help you set something up.

Regards,

Michael.

 

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information. 

 

Yes Michael, this is what I am doing right now. 

Our customized table is linked to the sc_cat_item and has all the reference field to either group and user. We also use approval type which is a select box type instead of a true/false for user's manager. Likely, I am using template for the task for the fulfillment.

However, I am stuck on the workflow as I am noob script writer. Would really appreciate any help from you based on your previous experience.

So our approval may have 3 situation 1. true = approval group or user; 2. true = reporting mgr; 3. false = no approval needed

Will you be able to help and share a script in the run script activity for approval and fulfillment? Appreciate it that much. TIA

For the approval I use the following script:

answer = [];
var gr = new GlideRecord("u_generic_workflow_variables");
gr.addQuery("u_catalog_itemsLIKE" + current.cat_item);
gr.addQuery("u_role", current.variables.role);
gr.query();
if (gr.next()) {
	var approvers = gr.u_approvers.split(',');
	for (i = 0; i < approvers.length; i++) {
		answer.push(approvers[i]);
	}
}

I have a role variable on my forms so they choose various roles which have different approvers but you wouldn't need that.

For the fulfillment task you need to select advanced on the catalog task activity and in the script section add something like this

var gr = new GlideRecord("u_generic_workflow_variables");
gr.addQuery("u_catalog_itemsLIKE" + current.cat_item);
gr.addQuery("u_role", current.variables.role);
gr.query();
if (gr.next()) {
	task.assignment_group = gr.u_fulfillment_group; //This change the variable here to your column name.
}

I hope this is making sense. Let me know if you need further explaination.

Regards,

Michael.

 

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.