4-Participant
June 4, 2024
Question
Hide Add participant action for CA1 role if user is part of PRA role and PR is in Open state.
- June 4, 2024
- 3 replies
- 1525 views
I am using Windchill PDMLink Release 10.2 and Datecode with CPS M030-CPS22
This is simple business requirement, can be tested or implemented on any latest Windchill version.
Step 1: user is part of Problem Report Author(PRA) for PR object
Step2 : If PR state is Open, then only allow PRA user to show add particpant icon for CA1 role in Members table.
Step3: If other then Open state, disable/hide the add participant for CA1 role.
For this i have written a validator is current user is part of PRA role, if so, then check for state of the object.
But stuck at a point, how can i check and hide the add participant action for CA1 role.
Is it possible thru Validator? or DataUtility?
For now, wrote a validator code as below:
if (wTObject instanceof PalmaProblemReport) {
WTPrincipal principal = SessionHelper.getPrincipal();
ContainerTeamManaged container = (ContainerTeamManaged) ((PalmaProblemReport) wTObject).getContainer();
WTRoleHolder2 t = TeamHelper.service.getTeam((TeamManaged) wTObject);
Vector roles = t.getRoles();
for (Enumeration e = roles.elements(); e.hasMoreElements();) {
Role role = (Role) e.nextElement();
if (role.toString().equalsIgnoreCase(GlobalConstantsIF.ROLE_PROBLEM_AUTHOR_REPORT)) {
Enumeration participants = t.getPrincipalTarget(role);
while (participants.hasMoreElements()) {
WTPrincipalReference participant = (WTPrincipalReference) participants.nextElement();
boolean hasAccess = EnterpriseHelper.service.isSiteAdministrator(principal)
|| participant.getPrincipal().equals(principal);
if (hasAccess) {
State prState = ((PalmaProblemReport) wTObject).getLifeCycleState();
if (!State.toState("OPEN").equals(prState)
&& /*STUCK HERE :: How to add logic to get the CA1 add participant action*/) {
UIValidationResult palmaResult = UIValidationResult.newInstance(paramUIValidationKey,
UIValidationStatus.DISABLED);
System.out.println("Dissabled");
results.addResult(palmaResult);
}
}
return results;
}

