Highlighted
Absent Member.
Absent Member.
616 views

Need to show Approve ,Deny and Retract buttons conditionally

Hi Team,

 

I have 3 buttons Approve, Deny and Retract displaying on the main menu when the phase is "change approval".

Now i have a requirement like :

If there are 2 (3,4,5,....) members in an approval group and one of the approver Approve or Deny the change then this approver should only be seeing Retract button.

And If the approver has Retract the change then he should see only Approve and Deny buttons.

Using SM 9.40

 

PFA

 

Regards,

Nikhil

0 Likes
7 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Need to show Approve ,Deny and Retract buttons conditionally

The out or box buttons already work that way for normal users. 

 

All three display options display for users with the capability to Override approvals (often change and system admins), but for regular users they work as described. Use the same conditions from the out of box display options. 

 

The system checks for interset of the user's approval authority/retract capablity and the record approvals in the displayscreen record (cm.view.display) and uses the result in the display options ($L.intersect). 

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Need to show Approve ,Deny and Retract buttons conditionally

Hi John / Team ,

 

Thanks for your response however still i am not able to achieve this request.

 

I checked the condition for all the 3 display options(Approve,Deny and Retract) and it is same as of respective out of box display options and it is :

 

evaluate(app.control in $L.phase)
and lng(denull(approval.groups in $L.env))>0
and evaluate(approvals in $L.env)
and open in $L.filed=true
and (lng($L.approval.intersect)>0 or approve.override in $L.env)
and nullsub($G.ess, false)=false

 

Now if i take example of form " Approval.g " and screen Id "approval.view" there the Display options are working as expected , e.g if one approver has approve the change then he is only able to see " Retract " and like wise for other scenarios. So i checked and found the display option conditon for

"approval.view_approve" is   "$L.can.approve

For "approval.view_deny"        is   "$L.can.approve"

And for "approval.view_retract"    is   "$L.can.retract"

 

Now my question is what this $L.can.approve and $L.can.retract stands for (what values they are holding) , where can i find them ?? 

Also the main issue is can i use the same variables on my main form " cm.change.approval "  and Screen Id " cm.view.display" for the 3 display options(Approve,Deny and Retract) .

And if not then how can i achieve the same funtionality as on form " Approval.g " and screen Id "approval.view" on my main form i.e "cm.change.approval "  and Screen Id " cm.view.displayfor the 3 display options(Approve,Deny and Retract) .

 

Regards,

Nikhil

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Need to show Approve ,Deny and Retract buttons conditionally

Those variables are set in the displayscreen record both for the approval record and for changes/tasks.

 

The out of box conditions for change function that way already; if you copy the condition from those to the display options which you added then to the cm.view.display toolbar, it should already work exactly as described.  If you are working wiht a custom displayscreen, you can copy the relevant lines from cm.view.display.

$L.appr.query="file.name=\""+str(filename($L.filed))+"\" and unique.key=\""+number in $L.filed+"\""

$L.delegate.name=jscall("ApprovalUtil.checkDelegate", $L.appr.query, str(filename($L.filed)));$L.approval.groups=jscall("ApprovalDelegationGroups.addDelegateGroups", approval.groups in $L.env, str(filename($L.filed)))

$L.void=rtecall("intersect", $L.err, $L.approval.intersect, $L.approval.groups, current.pending.groups in $L.filed);$L.void=rtecall("intersect", $L.err, $L.retract.intersect, approval.groups in $L.env, approved.groups in $L.filed)

The first line just sets up the query used in next line. The second line generates the $L.approval.groups array of groups for which a person may approve, including those for which they have current delegated authority. The third line generates the $L.approval.intersect and $L.retract.intersect that determine "can approve/deny" and "can retract".

 

Note: any user with Change Override capability will see all three options at all times. 

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Need to show Approve ,Deny and Retract buttons conditionally

Hi John\Team,

 

Thanks for replying on the querry 🙂

 

But i am not sure about the second condition that you shared in the screenshot :

 

$L.delegate.name=jscall("ApprovalUtil.checkDelegate", $L.appr.query, str(filename($L.filed)));$L.ame($L.filed)));$Lapproval.groups=jscall("ApprovalDelegationGroups.addDelegateGroups", approval.groups in $L.env, str(filename($L.filed)))

 

When i put it in display option " cm.view.display_approve" in the Pre Rad expression it throws error:

 

Validation failed (se.base.method,update.record)
file:(displayoption) key:(id=cm.view.display_approve) (se.base.method,update.record)
This record has changed since you selected it.
Field contains an invalid expression (display,show.rio)

 

I removed $L.ame($L.filed))); from the second querry and then saved the DO . And condition i modified to "$L.can.approve"

 

None of the DO(Approve,Deny and Retract) showing on "cm.change.approval"

-----------------------------------------------------------------------------------------------------------

Those variables are set in the displayscreen record both for the approval record and for changes/tasks.

Then when i gave condition "$L.can.approve" in DO "cm.view.display_approve" , why it didnt worked out infact no Display options are visible. 

 

The out of box conditions for the application modules  function that way already; if you copy the condition from those to the display options which you added then to the cm.view.display toolbar, it should already work exactly as described.

I checked it twice , the conditions are exactly same for all the 3 display options (approve,deny,retract) when i compared it with OOB Display options.Still the funtionality not working here on " cm.view.display"

 

 If you are working wiht a custom displayscreen, you can copy the relevant lines from cm.view.display.

I have to do the changes in cm.view.display (I believe) , So i am totally confused what to copy and where to copy.

 

Please let me know if I am mising few things or if i am not able to clearify the requirement, i am again communicating it.

My Requirement is :

As 3 display options(Approve,Deny and Retract) work on form " Approval.g " with screen Id "approval.view" , I want to implement the same functionality on my main form i.e "cm.change.approval " and Screen Id " cm.view.display" for the 3 display options(Approve,Deny and Retract) .

 

Regards,

Nikhil

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Need to show Approve ,Deny and Retract buttons conditionally

The expressions do not go in the display option.  They are in the display screen. Your post asked about where the $L.approval.intersect amd $L.retract.intersect variables were set. It is in the display screen. (NOTE: the $L.ame was a typo--it is now corrected above).

 

Please post the conditions you're using for your custom display options. 

 

Also: for the screen shot with all three buttons, is the logged in user a SysAmdin or ChMAdmin? Out of box they both have override capablity and will always see all three options based on the OOB conditions. The out of box condition for approve, for example:

evaluate(app.control in $L.phase) and lng(denull(approval.groups in $L.env))>0 and evaluate(approvals in $L.env) and open in $L.filed=true and (lng($L.approval.intersect)>0 or approve.override in $L.env) and nullsub($G.ess, false)=false

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Need to show Approve ,Deny and Retract buttons conditionally

Hi John\Team ,

 

Those querries already exist for the display screen " cm.view.display" and that is the display screen i am using for my DO(approve,deny and retract) .

 

PFA for more details.

 

Regards,

Nikhil

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Need to show Approve ,Deny and Retract buttons conditionally

Hi John\Team ,

 

Those querries already exist for the display screen " cm.view.display" and that is the display screen i am using for my DO(approve,deny and retract) .

 

PFA for more details.

 

Regards,

Nikhil

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.