Fire PHP based on workflow

Hey guys,

there is a limitation with logic hooks. Thats the events are pretty limited. I need to update some field and THEN use this field to trigger some other custom php code. When I try logic hook (after save or any other) it doesnt work because at the time of saving it the value of the updated field is still empty. I need to delay the trigger here. Best thing would be to have a workflow that would work like:

  1. check some checkbox field
  2. workflow -> fire when this checkbox field is updated (on change) - there would be some delay when firing it from workflow which is enough to use the field value in code.

Or is there some way to slow down the logic hook execution?

Not sure if this makes sense :frowning:

My problem is that the logic hook fires every time the record is saved (any field). So I have a condition in PHP - something like

if (!empty($somefield)) {run something}

And I need it to run when this field is NOT empty so it means I fill in something (or check a checkbox) but when it starts saving itself - the field I just checked is actually still empty. If I would try this one second later it would all work.

Or should I use another event for this hook?

“After_save hook executes after a record is saved into the db ”.

This is what the docs say but its not true (at least it doesnt work for me). For me - at the time the logic hook fires the checkbox is still unchecked… At least thats what the code sees.

Is this all about the same bean?

Why can’t you just do the two things you need to do in sequence, in a single logic hook call?

Just change Field1 and then Field2, why can’t you do that?

Mmmm didnt cross my mind :smiley: gonna try it :wink: Thank you!

1 Like

And yes its the same bean :wink: