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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

[IM] Is it possible to prevent a relationship by a trigger?

JensN.
14-Alexandrite

[IM] Is it possible to prevent a relationship by a trigger?

Hi @all,

in our changemanagement-datamodel we have an itemtype, which can have three different specifications depending on one field. As example: The item is a release-item, and a field "element" can switch the specification of the release-item between "module", "library" and "package". The item holds a relationship-field, and by this field we can build some kind of hierarchy: A Library can contain some packages and also some modules, but not another library. Its alway the head of this hierarchy. A package can contain other packages and also modules, and modules shouldnt contain any other item, because they are the smallest artefact in this hierarchy. The relationship-field can be configured to allow only specific item-types, but it cannot distinguish between the different specifications of the same item-type.

So i want to do something like this: If a user tries to connect two items over this relationship-field, a trigger should look at both item-types and the "element"-field and decide if its an allowed connection or not. If it isnt allowed, the trigger should show the user a message and prevent the connection. Is this possible? Maybe some kind of abort-function?

Thanks, Jens

              

                 

ACCEPTED SOLUTION

Accepted Solutions
LLawton
16-Pearl
(To:JensN.)

It's possible exactly the way you describe it in your last paragraph. Trigger scripts can call the abort function, hopefully with a friendly message that explains why.

I don't have such a script that works with relationships otherwise I'd send it, but maybe someone else does.

View solution in original post

2 REPLIES 2
LLawton
16-Pearl
(To:JensN.)

It's possible exactly the way you describe it in your last paragraph. Trigger scripts can call the abort function, hopefully with a friendly message that explains why.

I don't have such a script that works with relationships otherwise I'd send it, but maybe someone else does.

JensN.
14-Alexandrite
(To:LLawton)

Hi Laurent,

thank you for your reply, i tried it and it works!

Jens

Announcements


Top Tags