Forums / Developer / Creating a new trigger. Need help
Luis Muñoz
Wednesday 25 August 2004 2:25:57 am
Is it possible to create a trigger which executes a workflow only when a new object of one class is published but not executed when any other thing is published? I need to create triggers for three different content classes and leave the rest without trigger. Is there any other way to do this?
ThanksLuis
Eirik Alfstad Johansen
Wednesday 25 August 2004 3:42:20 am
Hi Luis,
Personally, I've done this the manual way, by starting the worflow with some code like this:
$db =& eZDB::instance(); // fetch most recently modified content object $query =<<<EOF SELECT id, contentclass_id, current_version FROM ezcontentobject WHERE status = 1 ORDER BY modified DESC LIMIT 0,1 EOF; // for each returned row foreach($db->arrayQuery($query) as $temp) { // store in result in $object $object = $temp; } $contentClassID = $object['contentclass_id'];
Hope this helps!
Sincerely, Eirik Alfstad Johansen http://www.netmaking.no/
Paul Forsyth
Wednesday 25 August 2004 4:29:31 am
You only need to create a new workflow event for this. Use content/publish/after as the trigger and within the event you can decide whether the object is of the right class and do the right thing.
Have a look at creating a workflow event in the docs and come back to this thread if you have problems.
paul
luis muñoz
Wednesday 25 August 2004 4:54:55 am
I created an event multiplexer workflow which first send an email to the user who published the object and after that begins an approval workflow. The problem is that I don’t want that this workflow executes with forum items. How can I filter the class in both mailer and approval workflows? Or how can I filter in event multiplexer workflow?I’m sure that object class is in the parameters that the workflow get but I don’t know how to get it.
Thanks in advanceLuis