Administration Guide : More Details about Triggers and Actions : Example: Customizing an Action that ships with Xinet

Example: Customizing an Action that ships with Xinet
While you can write Actions in any executable format, modifying an Action that ships with Xinet will illustrate some rules to keep in mind whether you’re customizing an existing Action or writing a new one. If you plan to write your own Actions rather than modify one that exists, please also refer to Background for writing your own Actions.
In our example, we will customize the email Action so that it includes the file ID along with the file name, the HTML path, the keyword that changed, and the name of the user triggering the email:
On Unix systems:
1.
2.
Copy the email Action directory to a directory with a new name:
cp /usr/etc/webnative/actions/email /usr/etc/webnative/actions/new_email
3.
cd /usr/etc/webnative/actions/new_email
4.
Rename all Action-name files: The files within the Action must match the name of the Action, so email and email.* must be renamed to new_email and new_email.*.
5.
Open the file new_email.conf in a text editor and add fid to the list of stdargs:
stdargs=f,p,k,u,fid.
6.
Open the email script in a text editor (in our example, the file new_email) and edit the Set the usage message portion by changing:
set USAGE = "usage: $0 -f <filename> -p <htmlpath> -k <keyword> -u <user> -arg0 <to@mail.address> -arg1 <subject> -arg2 <path to body file> [-arg3 <sender@address>]"
So that it reads:
set USAGE = "usage: $0 -f <filename> -p <htmlpath> -k <keyword> -u <user> -fid <fileid> -arg0 <to@mail.address> -arg1 <subject> -arg2 <path to body file> [-arg3 <sender@address>] "
7.
Then search for the portion of the script that pertains to Check argument count to confirm correct usage. Just after the four lines that define case “-u”, insert four new lines, like this:
case "-fid":
@ i++
setenv XFID "$argv[$i]"
breaksw
On Windows:
Use the analogous methodology to modify the new_email.bat file.
General rules for modifying or writing new Actions:
1.
You may wish to modify the file, name_of_action.desc, in order to differentiate the original Action for the newly-created one in the GUI.
2.
When modifying an existing Action, do not simply edit it. Always make a copy to edit because Actions with the same name as those that ship with Xinet may be overwritten when you install future versions of Xinet.