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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Can the Form Delegate's scope remain only in the sub type?

CZ_9645217
14-Alexandrite

Can the Form Delegate's scope remain only in the sub type?

Dears,

 

I have created a new subtype of change notice and a subtype of change task, when I create a new change notice for a part I need to define the change task, for this change task I am using my own defined subtype, when clicking on the completion of this task I need to use the I need to use a custom Form Delegate to check the lifecycle state of the resulting object when clicking on the completion of the task, I've already implemented it, but this customized function will affect all the change tasks, so is it possible to define the Form Delegate only for a specific subtype? Thank you!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ANNA_02
13-Aquamarine
(To:CZ_9645217)

I think type checking is an easier way of validating and shouldn't be much of a burden. Another approach is to add supportedTypes tag in action.xml, from where the custom delegate code is being called.
<supportedTypes>
<type value="WCTYPE|wt.change2.WTChangeActivity2|<custom_subtype>"/>
</supportedTypes>


However, in this case, we might still need to handle out-of-the-box (OOTB) cases with an 'if-else' statement in the code. Give it a try and see if it helps.

View solution in original post

3 REPLIES 3
ANNA_02
13-Aquamarine
(To:CZ_9645217)

Inside your custom form delegate code, you can fetch a List<ObjectBean>, traverse through them, and check if the ObjectBean's type is of WTChangeActivity2. If it is, you can then further check if it is of your custom subtype using TypeIdentifierUtility.

 

WTChangeActivity2 ca = (WTChangeActivity2) objectBean.getObject();
//if ca is instance of custom_subtype
//if true then procced with business logic for checking the lifecycle state of the wtobject

 

pseudo code: (Check ptc articles for more examples)
String typeIdentifier = TypeIdentifierUtility.getTypeIdentifier(ca).getTypename();
if ("custom_subtype".equals(typeIdentifier))

CZ_9645217
14-Alexandrite
(To:ANNA_02)

@ANNA_02  Thanks for your reply, This is accomplishing the goal, but I have another concern, this function will still work globally, we are just filtering the corresponding subtypes in the code, as the global will call this code every time the finish button is clicked, will this be a burden on the system?  Going back to this original requirement, is there a better way to verify the lifecycle state of the Resulting object when I create a Task? Thank you.

ANNA_02
13-Aquamarine
(To:CZ_9645217)

I think type checking is an easier way of validating and shouldn't be much of a burden. Another approach is to add supportedTypes tag in action.xml, from where the custom delegate code is being called.
<supportedTypes>
<type value="WCTYPE|wt.change2.WTChangeActivity2|<custom_subtype>"/>
</supportedTypes>


However, in this case, we might still need to handle out-of-the-box (OOTB) cases with an 'if-else' statement in the code. Give it a try and see if it helps.

Top Tags