Approval - User not creating approval tasks if 'created by' matches the user who needs to approve.

Carl Fransen1
Kilo Sage

Hi All,

Having some simple issues with my workflow and wondered  this is working by design, something I've done wrong, or is a bug in the system.

I have a simple workflow to generate 2 approval records, request manager approval (via script) and then one-up manager approval (also via script).  The two approver activities are essentially identical, they only point to a different field.  See workflow and activity screenshots below:

find_real_file.png

 

find_real_file.png

 

The requirement should also for a person to open a HR Case for someone else, hence the 'requester' can be different, but this still doesn't create the correct approval tasks.

Can anyone help me figure out why the approvals aren't generated if the 'opened_by' matches the person the approval is being requested from?

Much appreciated.

1 ACCEPTED SOLUTION

In the end what I did here was to add validation to the Record Produce to disallow the user to put themselves as the approvers.  I added a Catalogue Client Script, OnSubmit, to throw up an error and stop the save from occurring.

The original problem around the approval tasks no appearing was the BR shown in a previous update, this is still needed for the Change process where people sit in multiple groups but cannot approve their own changes.

Thanks for all your help with this.

 

Cheers

Carl.

View solution in original post

11 REPLIES 11

Thanks Diana - I have had this in the past also.  In this case though it's definitely got data as I'm outputting all the fields to the HR Case description and I can see they are completed correctly.

Carl Fransen1
Kilo Sage

I think it might have something to do with this Business rule:

find_real_file.png

 

Not being a 'coder' how can I change this to actually only restrict to the 'requester' and not the 'current user' who logs the case - as I definitely don't want requesters to be able to approve their own HR Cases.

 

Thanks team!

Yes This is the BR which is restricting.

because here your checking if the approver is your current user that is requestor in this case it is aborting the action.

In activate this BR and your workflow should work fine,

Regards
Harish

Yes that would work, but deactivating this completely will allow the requester to approve their own - which we don't want.  We only want to avoid the 'opened_by' from approving their own - any ideas how we would update the code to do this?

 

Thanks.

The best way would be to write a IF script before approval and check the opened-By==approver name and then you can do what ever the flow you needed

  1. answer = ifScript();  
  2. function ifScript() {  
  3.   if (current.getValue('opened_by') == current.variables.<variable name here>{  
  4.               return 'yes'; // no approval  
  5.           }  
  6. else{  
  7.       return 'no';  
  8.   }  
  9. }  
Regards
Harish