Additional Condition on Approval User Activity

saikatmitra
Tera Contributor

Hi Team,

My requirement is to add another condition like 'Approved' and 'Rejected', called 'More Information Required' in the Approval Group Activity,

 

so I have created the condition 'More Information Required' in the workflow activity

and added the same in Choices of State field on Approval(sys_approval_approver) table.

 

And in the condition field added : activity.result =='more_info_required'

 

Now, when I select approve or reject the workflow goes to the next activity but not when I select More Information Required in the

approval table record, it gets stuck in the same activity and doesn't proceed.

 

find_real_file.png

 

I am sure I am missing something, I don't know how does the activity.result gets set to the state(like in case of approve and reject)

 

Can someone please help me on this.

 

 

Thanks in advance

 

16 REPLIES 16

Jaspal Singh
Mega Patron
Mega Patron

Hi Sai,

 

I guess you need to add state choice value: more_info_required for table Group approval (sysapproval_group) & not Approvals (sysapproval_approver) as you are using Group approval activity & not Approver- User

Ankur Bawiskar
Tera Patron
Tera Patron

@saikatmitra 

Did you create a custom choice on sysapproval_approver state field i.e. "More Information Required"

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

DirkRedeker
Mega Sage

Hi

I do not think, it will be sufficient to add the choices.

If I look into the Workflow definition of the "Approvoal - Group" Workflow Activity under

> Workflow > Administration > Activity Definition

find_real_file.png

There is a function at line 424, which determines the result of the "Approval Group" Activity.

I think (not sure), that you need t add your option here to work properly. This would mean to change the OOB Script in the Activity Definition.

In this case, I STRONGLY recommend to make a COPE of the "Approval Group" WF Activity and name it e.g. "My Custom Group Approvals" to distinguish!

Then you can experiment with it.

Let me know about your advance in this topic.

BR

Dirk

 

Thank you all for all your suggestions. The below code had worked for me.

 I figured it out by myself.

 

var answer = '';
//one approval to approve the activity
for (var id in groups) {
var group = groups[id];
if (group.more_info_required == 1){
gs.log("answer is :"+answer);
answer = 'more_info_required';
gs.log("answer is set :"+answer);
}
else if (group.approved == 1){
gs.log("answer is :"+answer);
answer = 'approved';
gs.log("answer is set :"+answer);
}
else if (group.rejected == 1){
gs.log("answer is :"+answer);
answer = 'rejected';
gs.log("answer is set :"+answer);
}
else{
answer='';
}
}

Hi

Thanks for your feedback. Can you please let me know, how you set the "Approval - Group" to "more_info_required"?

Do you have some extra BR implemented?

You cannot manually set this "State" to the Group Approval record.

I would like to see the details that brings the "group.more_info_required" value to "1".

Thanks for letting me know, please.

BR

Dirk