cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Make Approver role mandatory in Promotion Request

DK_11085982
2-Explorer

Make Approver role mandatory in Promotion Request

Hi team,

 

Trying to have some insight on Promotion Request.

Using OOTB Promotion request. Scenario is: when we are on the Select Participant tab while creating Promotion Request, even if we don't select any user request gets created and gets assigned to users in approver role.

The ask is, if no user is selected in Select Participant tab for Approver the Promotion Request should not get created and throw an error Approver needs to be assigned.

Any help on this.

5 REPLIES 5
avillanueva
22-Sapphire II
(To:DK_11085982)

I would add a code check for this in the transitions of that workflow task. It only needs to throw a WTException to kick it back to the user and not allow them to complete the task.

Can you give some more guidance as to what this code check would look like? I assume that the best place would be the first Conditional after the PR was initiated, where the OOTB code checks for valid and invalid iterations of the promotion object(s). There's already an OOTB loop for invalid iterations to return the PR to the originator to resolve the business rules conflicts, but I don't know how to include something like  (approver.isEmpty) in that routing expression. 

Hi @DK_11085982,


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.


Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator

@DK_11085982 and @ES_11249468 ,

 

You can do this with a form delegate. The delegate is just a Java class with the appropriate code to get the job done.

It runs when the user hits the "Finish" button. Simple to setup.

 

In short, the Java code runs when you hit the Finish button during the Promotion Request creation.

The custom Java class delegate that I wrote does 5 checks including checking for at least one participant in the mandatory roles.

 

Currently the checks include:

1. If the creator has added himself/herself to any restricted roles, for example Approver or Review. No one should be the Approver or Reviewer for Promotion Requests that they create.
2. Do all mandatory roles have at least one users.
3. Are any of the promotables already on an active Promotion Request.
4. Validates all promotables are in the same container as the Promotion Request
5. Validates the select workflow is in the same container as the Promotion Request

 

The code can be edited to do whatever is specified.  It's just a matter of knowing what's required.

 

If any of the checks find a problem, the user cannot create the Promotion Request until the problems are fixed, and a window is displayed to the user stating exactly what the problems are.

The idea is to fix everything BEFORE the Promotion Request is created and the workflow started.

 

 

Here's a screen shot showing the errors.  In this case I'm creating a Promotion Request that has an object that is already on an active Promotion Request and I have neglected to specify Approver an Reviewer.

 

d_graham_1-1730723656357.png

 

 

You might consider a second delegate to run in when editing a Promotion Request.

The edit delegate/class I wrote checks two thing.

1. Are any of the promotables already on an active Promotion Request (other than the one being edited of course).
2. Validates the promotables are in the same container as the Promotion Request

 

If any of the checks find a problem, the user cannot edit the Request and a window is displayed to the user exactly what the problem is.

 

 

ES_11249468
6-Contributor
(To:d_graham)

This is exactly what I'm looking for! Would you be willing to share what your code looks like here? I'm very new to Java and I don't know how I would se5t up these delegates.

Announcements


Top Tags