Customization for warning message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Customization for warning message
Whenever an alternate link is created between 2 parts, a pop/warning message should appear saying "You are adding this as a global alternative. Consequently this Alternate part and will be introduced into all BOMs where the previous part is used"
How to achieve this?
- Labels:
-
Business Logic Customization
- Tags:
- windchill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Article - "Alternate Part vs Substitute Part in Windchill PDMLink": https://www.ptc.com/en/support/article/CS214847
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SK_12337814
Could you provide any screen shot how you wish to present the error to the user? - when/where
PetrH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Wanted to know the approach for customisation........im adding a part as an alternative part to another part.....now before confirming, I need to get a warning/alert message with the above message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SK_12337814
It is complicated and not recommended.
You can decompile OOTB processor and add a warning message in the preProcess method.
The problem is that the OOTB class is in a wncWeb.jar package and you have to take it decompile, rewrite(add the code to add a warning) compile it, place it in the codebase folder and remove the class from the wncWeb.jar file (<wt_home>\codebase\WEB-INF\lib).
the Wizard class: com.ptc.windchill.enterprise.part.forms.AlternatesSubstitutesFormProcessor
This is just an example, but you can any condition when the message should appear.
public FormResult preProcess(NmCommandBean var1, List<ObjectBean> var2) throws WTException {
log.debug("In preProcess");
this.whichReplacementsButton = var1.getTextParameter("whichReplacementsButton");
if (!this.isCancelButton()) {
this.formData = getFormData(var1);
this.addItemOids = var1.getAddedItemsByName("replacementsTable");
this.addItemOids = this.removeDuplicate(this.addItemOids);
this.removedItemOids = var1.getRemovedItemsByName("replacementsTable");
this.addSubstituteOids = this.getAddedPart("addSustituteLink_replacementsTable", var1);
this.addAlternateOids = this.getAddedPart("addAlternateLink_replacementsTable", var1);
}
// CUSTOMIZATION ADDED TO SHOW THE WARNING MESSAGE
FormResult result = new FormResult();
result.setStatus(FormProcessingStatus.NON_FATAL_ERROR);
ArrayList<String> incorrectMessages = new ArrayList<>();
incorrectMessages.add("PreCheck Failed");
WTMessage errorTitle = new WTMessage("com.ptc.core.ui.errorMessagesRB", "35", new ArrayList[]{incorrectMessages}); // 32 - Error, 33 - Info, 35 - Warning
FeedbackMessage fMS = new FeedbackMessage(FeedbackType.CONFIRMATION, var1.getLocale(), errorTitle.getLocalizedMessage(var1.getLocale()), incorrectMessages, "You are adding this as a global alternative. Consequently this Alternate part and will be introduced into all BOMs where the previous part is used");
result.addFeedbackMessage(fMS);
return result;
}
PetrH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can we add this to a custom class and call it from the custom actions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Easier approach might be to block access to creating alternates to a few special users who know how to use them and what they mean. The rest of the users can use substitute links.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @avillanueva
Yes, also, you can create a listener that controls the Link creation and throw the error that user is not allowed to create the link...
PetrH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@HelesicPetr @avillanueva It would be so much easier if there was a possibility to show a confirmation dialog from an event instead of having only the block possibility.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Was thinking the same though. Can it be a trigger of an info message instead a warning one box after clicking ok.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I did similar thing for deleting WTPart that is connected to a ProcessPlan with overridable error if user is sure to delete the WTPart in a event manager
PetrH
