Skip to main content
1-Visitor
May 18, 2016
Solved

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

  • May 18, 2016
  • 1 reply
  • 2286 views

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

              

                 

Best answer by LLawton

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.

1 reply

LLawton16-PearlAnswer
16-Pearl
May 18, 2016

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.1-VisitorAuthor
1-Visitor
May 19, 2016

Hi Laurent,

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

Jens