Skip to main content
1-Visitor
January 9, 2017
Question

Trigger validation before saving an entity on composer?

  • January 9, 2017
  • 5 replies
  • 2411 views

Is there a way to create a trigger or some kind of validation at clicking save button or importing entities from file?

5 replies

1-Visitor
January 10, 2017

Every time you import/Save an entity it's restarted, hence you can bind your validation code at ThingStart.

aluna1-VisitorAuthor
1-Visitor
January 10, 2017

In that case you will have to add that code to every entity you want to import/save, but what I am trying to accomplish is like a centrilized trigger or validator that can be run everytime you save or import things, is this possible?

1-Visitor
January 10, 2017

Hello Armando, what is your outcome of using the "ThingStart" event ? Is Carles answer the correct one ?

aluna1-VisitorAuthor
1-Visitor
January 10, 2017

I guess no,In that case you will have to add that code to every entity you want to import/save, but what I am trying to accomplish is like a centrilized trigger or validator that can be run everytime you save or import things, is this possible?

1-Visitor
January 11, 2017

Hi Armando,

You can build a ThingShape which subscribes to ThingStart Event and add this ThingShape to all the Things that you want to supervise. The problem with this it's that one you do this you can't have any other subscription to ThingStart event as TW from 6.5 doesn't allows multiple subscriptions to the same event from the same thing.

Carles.