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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

How to set the conflict description message for implementing rename using custom listener

Vishwa_RADDI
10-Marble

How to set the conflict description message for implementing rename using custom listener

Version: Windchill 12.1

 

Use Case: I have written custom listener will use the event "IdentityServiceEvent.PRE_CHANGE_IDENTITY" for if WTPart New Number is NOT 10-digit validation and not able to dispay the conflict description message in Event Console


Description:

I have written custom listener will use the event "IdentityServiceEvent.PRE_CHANGE_IDENTITY" for if WTPart New Number is NOT 10-digit validation and not able to dispay the conflict description message in Event Console

10 REPLIES 10

@Vishwa_RADDI ,

I saw your post and it seemed very doable.

 

I renumbered a WTPart to be 6 characters long.

d_graham_0-1718105112771.png

As expected, I get a failure and the error description is exactly what I coded.

Seems to work to your spec, unless I'm misunderstand your post.

d_graham_2-1718105332093.png

 

David

windchill.developer@yahoo.com 

 

 

Hi David,

 

how do you set this custom message on Conflict event console? I have tried using WTException(new WTMessage); and just throwing an exception its not working. let me know how do we set?

 

Thanks,

Vishvanatha

 

Hi @Vishwa_RADDI 

It is more complicated then just throw WTException.

You should create object a ConflictException with a ConflictElement that contains a ResolutionType and a ConflictType with your message to a user. 

 

I did similar exception for deleting WTPart that is linked to a process plan. User has a option to repeat and finish deletion or nothing else. 

PetrH

Hi Pert,

 

Thanks for suggestion, could you please add snipet of source code so I will try.

 

Thanks,

Vishvanath

Hi @Vishwa_RADDI 

Knowledge base contains some information 

CS104731 - API to override conflict on EPMWorkspaceHelper

PetrH

Hi PetrH,

 

Yes I have already tried with this examples as  you mentioned, still not printing any ERROR. 

 

Thanks,

Vishvanatha

Yes, because the example just shows one part of the solution.

You have to throw the correct error 

ConflictException conflict = new ConflictException(new ConflictElement[]{conflictElement});
throw conflict;

PetrH

Yes I have tried as below snippet code, still not working

ConflictElement[] conflictElements = new ConflictElement[setConflictElements.size()];
conflictElements = setConflictElements.toArray(conflictElements);
throw new ConflictException(conflictElements);

So it works

You just do not see any message that the user could read 😄 

So you have to write the message to the user. 

PetrH

we dont have any user level settings in this API's it should work or could you provide snipnet so I will check?

Announcements

Top Tags