How to create a trigger "when a field value is changed (regardless of the value), create a new card in a new tab"

Hey @iurirb

@fernando.nakandakari Could you help Iuri with some tips and directing the right document to help him build his code?

1 Like

Hey @iurirb

What you’re looking for is comparing the old value of the record with the new value of the record. Which means it’s a comparison between the values in $objectNew vs $objectOld.

You can read more about it here: $objectNew and $objectOld

In this case, something like this should work:

if($objectNew['field'] != $objectOld['field']){
   your code goes here
}
2 Likes

@fernando.nakandakari como seria a parte do código pra criação do registro em uma outra tab?

Hey, @iurirb

You’d need to build the new record in an array making field => value pairs, then use Jestor.create() to create the record.

For example:

if($objectNew['field'] != $objectOld['field']){
   $newrecord = array(
      "name" => "Example",
      "email" => "email@email.com"
   );
   Jestor.create("client",$newrecord);
}

You can see more about Jestor.create() here: https://docs.jestor.com/docs/native-methods
1 Like