Difference between revisions of "Triggering Reaction"

From SDU
Jump to: navigation, search
m
m
Line 1: Line 1:
 +
__NOTOC__
 +
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 +
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 +
 +
== Overview ==
 
This article shows how items passed through a trigger can be queried from the script.
 
This article shows how items passed through a trigger can be queried from the script.
<br>
 
  
 +
 +
== Description ==
 
Lets assume we have already added a [[Site-Defined Trigger]] to call zMyScript and pass the Assignee value.
 
Lets assume we have already added a [[Site-Defined Trigger]] to call zMyScript and pass the Assignee value.
  
  
 
'''Example:'''<source lang="javascript">POST_VALIDATE zMyScript(assignee) 111 FILTER(EVENT("UPDATE"));</source>Lets focus only on the zMyScript(assignee) portion.
 
'''Example:'''<source lang="javascript">POST_VALIDATE zMyScript(assignee) 111 FILTER(EVENT("UPDATE"));</source>Lets focus only on the zMyScript(assignee) portion.
 
  
 
Three items of information regarding the assignee are passed from the trigger to the script.<br>
 
Three items of information regarding the assignee are passed from the trigger to the script.<br>
Line 12: Line 17:
 
<nowiki>[2]</nowiki> is the last known value when the trigger was initiated.<br>
 
<nowiki>[2]</nowiki> is the last known value when the trigger was initiated.<br>
 
<nowiki>[3]</nowiki> is the new value that is expected to be saved.<br>
 
<nowiki>[3]</nowiki> is the new value that is expected to be saved.<br>
 
  
 
We can then query item <nowiki>[1]</nowiki>, <nowiki>[2]</nowiki>, or <nowiki>[3]</nowiki> in our script as needed.
 
We can then query item <nowiki>[1]</nowiki>, <nowiki>[2]</nowiki>, or <nowiki>[3]</nowiki> in our script as needed.
Line 24: Line 28:
 
     };
 
     };
 
   };</source>
 
   };</source>
 
 
----
 
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 

Revision as of 21:56, 25 July 2008

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This article shows how items passed through a trigger can be queried from the script.


Description

Lets assume we have already added a Site-Defined Trigger to call zMyScript and pass the Assignee value.


Example:<source lang="javascript">POST_VALIDATE zMyScript(assignee) 111 FILTER(EVENT("UPDATE"));</source>Lets focus only on the zMyScript(assignee) portion.

Three items of information regarding the assignee are passed from the trigger to the script.
[1] is the original state value before editing began.
[2] is the last known value when the trigger was initiated.
[3] is the new value that is expected to be saved.

We can then query item [1], [2], or [3] in our script as needed.


Example: <source lang="javascript">cr::zMyScript(...){

 if( is_null( argv[3]){
   set_error( 1);
   set_return_data( "Assignee need to be filled.");
   };
 };</source>