%META:TOPICINFO{author="TWikiContributor" date="1510812229" format="1.1" version="$Rev$"}%
---+!! If-Then-Action Plugin
<!--
   Contributions to this plugin package are appreciated. Please update this page at
   http://twiki.org/cgi-bin/view/Plugins/IfThenActionPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/IfThenActionPluginDev.
   If you are a TWiki contributor please update the extension in the SVN repository.
-->
<sticky>
<div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div>
<div style="float:right; width:538px; margin:0 0 20px 20px; padding:0 10px 0 10px;">
<img src="%ATTACHURLPATH%/diagram.png" alt="diagram.png" width="538" height="280" />
</div>
</sticky>
%SHORTDESCRIPTION%

---++ Introduction

This plugin is intended to help automate workflows. Administrators can define if-then actions in a rules table. For example, every time a topic is updated, another topic should be viewed in the background, with the purpose to refresh that other topic's cache.

---++ Description

Administrators define if-then-action rules in a table. The rules have format "if source then target". The "if" is the trigger (if-action), "source" is the source topic, "then" is the action to take (then-action), and target is the target topic to take action on.

Developers can create additional if-actions and then-actions as needed.

To avoid infinite loops, if-then-actions are not recursive. For example, a save if-action does not trigger a new save if-action on a target topic.

---+++ If-Then-Action Rules Table

If-then-action rules are defined in a table at <b>%IF{
 "istopic '%USERSWEB%.IfThenActionRules'"
 then="[[%USERSWEB%.IfThenActionRules]]"
 else="<nop>%USERSWEB%.IfThenActionRules ([[%SCRIPTURL{edit}%/%USERSWEB%/IfThenActionRules?templatetopic=%SYSTEMWEB%.IfThenActionRulesTemplate;topicparent=none;nowysiwyg=1][create this topic]])"
}%</b>. By default it is access restricted to members of the %USERSWEB%.TWikiAdminGroup.

Sample table, for illustration:

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.SourceTopic | view | !Sandbox.TargetTopic | This does a normal topic view on the target |
| register | %<nop>WEB%.%<nop>TOPIC% | touch | !Main.RegisteredUsers | This does an edit-save cycle on the target topic on successful user registration |

%STARTSECTION{ifThenColumnsHelp}%
#RulesTableHelp
__Help on rules table:__

   * *If*: The if-action is the trigger.
      * Currently implemented if-actions:
         * =action= - take action on a =%<nop>IFTHEN{ "action" }%= variable.
            * The variable takes an optional =topic= parameter to overload the current topic, such as: =%<nop>IFTHEN{ "action" topic="Web.TopicName" }%=.
         * =register= - take action after successful user registration.
           %BR% %X% __Note:__ The Source must be set to: =%<nop>WEB%.%<nop>TOPIC%=
         * =save= - take action after saving a topic.
         * =upload= - take action after uploading a file attachment.
         * =view= - take action on topic view. The action is triggered at the end of the page rendering process.
      * __Note:__ If-actions can be disabled in configure, some might not be available.
         * Available if-actions: <tt>%IFTHEN{if-actions}%</tt>

   * *Source*: Source topic or source condition. Syntax:
      * Specify the =Web.TopicName= of the topic that should trigger an action, or a comma-space list of topics such as =Web1.Topic1, Web2.Topic2=.
      * Wildcards can be used for the topic name, such as =CID-*= to indicate names starting with CID-.
      * A condition can be crafted using %SYSTEMWEB%.TWikiVariables such as =[[%SYSTEMWEB%.VarIF][%<nop>IF{}%]]= or =[[%SYSTEMWEB%.SpreadSheetPlugin#FuncIF][%<nop>CALCULATE{$IF()}%]]=.
         * Use =%<nop>WEB%= and =%<nop>TOPIC%= to indicate the source web and topic, respectively.
         * The result of the condition should a =Web.TopicName= to take action on, a topic list, or an empty string to cancel the action.

   * *Then*: The then-action is the action taken.
      * Currently implemented then-actions:
         * =attachsection= - attach the content of a section as a file attachment.
         * =email= - send an e-mail based on an e-mail template topic.
         * =setformfield= - update a form field of a target topic.
         * =setpreference= - set or update a preferences setting of a target topic.
         * =touch= - edit and save a target topic without making any content change.
         * =view= - view a topic and wait for the rendering.
         * =viewdaemon= - view a topic asynchronously, e.g. non-blocking; useful if the view of the target topic is slow.
      * __Note:__ Then-actions can be disabled in configure, some might not be available.
         * Available then-actions: <tt>%IFTHEN{then-actions}%</tt>

   * *Target*: Target topic and more. Syntax:
      * =Web.TopicName= of the topic to take action on, or a comma-space list of topics such as =Web1.Topic1, Web2.Topic2=.
      * The web name is optional; the source web is used if omitted.
      * Tokens can be used instead of the topic name:
         * =$topic= - name of source topic.
         * =$parents= - parent trail, up to 64 parents up.
         * =$parents(5)= - parent trail, up to 5 parents up.
         * =$parent= - topic parent.
         * =$parent(5)= - the 5th parent up in the parent trail.
         * =$children=: expands to all direct children.
         * =$children(5)=: expands to all children recursively 5 levels deep.
         * =$children(10 CID-*)=: expands to all children 10 levels deep, using only topic names starting with CID-* (if possible specify a topic name filter with wildcards for better performance).
      * The then-action is cancelled in case the target topic does not exist, such as if there is no parent when using =$parent=
      * Example target: =Web.SomeTopic, !Web.NotExistingTopic, !Web.$parent, !Web.$children=
      * Example output: =Web.SomeTopic, !Web.ItsParent, !Web.ItsChild1, !Web.ItsChild2, !Web.ItsChild3=
      * The target can be crafted dynamically using %SYSTEMWEB%.TWikiVariables such as =[[%SYSTEMWEB%.VarFORMFIELD][%<nop>FORMFIELD{}%]]= and =[[%SYSTEMWEB%.VarCALCULATE][%<nop>CALCULATE{}%]]=.
         * Use =%<nop>WEB%= and =%<nop>TOPIC%= to indicate the source web and topic, respectively.
      * The syntax differs based on the then-action.
         * Example =setformfield= then-action target: =$children/$formfield(Status) = $formfield(Status)=
         * Example =setpreference= then-action target: =$topic/ALLOWTOPICCHANGE = $formfield(Owner)=

%ENDSECTION{ifThenColumnsHelp}%

---+++ Then-Action: !AttachSection

The "attachsection" then-action attaches the content of a section in a source topic as a file attachment to a target topic. Use this to generate style sheets (=.css= files) and other files from topic content. TWiki variables are expanded. Leading and trailing newlines are removed except for one trailing newline.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.StyleSheets | %RED% *attachsection* %ENDCOLOR% | $topic/*.css | Attach the content of all sections where the name ends in .css as file attachments to the same topic |

__Target syntax:__

   * Specify =Web.TopicName/section=, or a comma-space delimited list, such as =Web1.Topic1/section, Web2.Topic2/section=.
   * Tokens for topic names such as =$topic= can be used as well, as documented in the [[#RulesTableHelp][rules table help]].
   * The =section= is the name of a section; wildcards can be used, such as =*.css= to indicate all section names ending in =.css=.

%TWISTY{
 mode="div"
 showlink="Show example %ICONURL{toggleopen}% "
 hidelink="Hide example %ICONURL{toggleclose}% "
}%
1. Create a topic, such as !Sandbox.TestAttachSection, and add this content:

<div style="background-color: #eee; padding: 5px 10px; border: gray solid 1px;">
<verbatim>
<verbatim>
%STARTSECTION{"helloworld.css"}%
.helloWorld {
  color: red;
  background-color: #eee;
  border: dotted gray 1px;
  padding: 3px 8px;
}
%ENDSECTION{"helloworld.css"}%
</verbatim>

Test:
%ADDTOHEAD{
 "helloWorld"
 text="<style type='text/css' media='all'>
@import url('%ATTACHURLPATH%/helloworld.css');
</style>"
}%
<span class="helloWorld">
Hello World
</span>
</verbatim>
</div>

2. Add an if-then-action rule to the rules topic:

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.TestAttachSection | attachsection | $topic/helloworld.css | Attach the content of the helloworld.css section as a file attachment of the same name to the current topic |
%ENDTWISTY%

---+++ Then-Action: Email

The "email" then-action sends an e-mail based on an e-mail template topic.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *email* %ENDCOLOR% | !Sandbox.IfThenActionEmailTemplate | This sends an e-mail based on the target template when the source topic is updated |

__Target syntax:__

   * Specify =Web.EmailTemplateTopic= containing the e-mail template.
   * Tokens such as =$parent= can be used for the topic name, as documented in the [[#RulesTableHelp][rules table help]].
   * Specify =%<nop>WEB%.%<nop>TOPIC%= as the Source if you want to get e-mail on every topic save.
   * Format of the e-mail template:
      * Content outside =%<nop>STARTINCLUDE%= and =%<nop>STOPINCLUDE%= is ignored.
      * The template must conform to an e-mail format with e-mail header and e-mail body separated by two newlines.
      * The header must contain at least =To:= and =Subject:= fields.
      * Do not specify the =From:= header field, it is added automatically.
      * %SYSTEMWEB%.TWikiVariables can be used in the e-mail header and body.
   * Example e-mail template:
     %BR% =The part before STARTINCLUDE is ignored=
     %BR% =%<nop>STARTINCLUDE%=
     %BR% =To: %<nop>WIKIWEBMASTER%=
     %BR% =Subject: [TWiki Notification] %<nop>WEB%.%<nop>TOPIC% has been updated=
     %BR% =<nop>=
     %BR% =%<nop>WIKINAME% just updated %<nop>WEB%.%<nop>TOPIC%=
     %BR% =URL: %<nop>SCRIPTURL{view}%/%<nop>WEB%/%<nop>TOPIC%=
     %BR% =<nop>=
     %BR% =This is mail has been sent by TWiki's !IfThenActionPlugin=
     %BR% =%<nop>STOPINCLUDE%=
     %BR% =The part after STOPINCLUDE is ignored=

---+++ Then-Action: !SetFormField

The "setformfield" then-action updates a form field of a target topic to any value, such as the value of a form field of the source topic.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *setformfield* %ENDCOLOR% | $children/$formfield(Number) = $formfield(Number) | This updates all children's Number form field to the current topic's Number form field |

__Target syntax:__ =target = expression=, such as =Web.SomeTopic/$formfield(Status) = $children/$formfield(Status)=

   * =target= &nbsp; - target form field, defined by =topic/$formfield(Name)=:
      * =topic= &nbsp; - this is =Web.TopicName= as described in the [[#RulesTableHelp][rules table help]]; tokens such as =$children= can be used.
      * =/= &nbsp; - a slash to separate topic and form field.
      * =$formfield(Name)= - the form field.
   * =<nop>=<nop>= &nbsp; - an equal sign.
   * =expression= &nbsp; - either a value, or a source form field of format =$formfield(Name)= or =topic/$formfield(Name)=:
      * =topic= &nbsp; - this is =Web.TopicName= as described in the [[#RulesTableHelp][rules table help]]; tokens such as =$topic= can be used.
      * =/= &nbsp; - a slash to separate topic and form field.
      * =$formfield(Name)= &nbsp; - the form field.
      * The topic is optional, the source topic is assumed if missing
      * If =$formfield(...)= is missing, the value is used verbatim - useful if the expression is set dynamically by the result of %SYSTEMWEB%.TWikiVariables.

%X% __Known limitation:__ The plugin does not check for validity of the form field value. For example, it is possible to set an empty value even if the field has the mandatory flag set. Or, it is possible to set an arbitrary value for a select field that is not in the list of options. Therefore make sure to validate the value before setting a form field.

---+++ Then-Action: !SetPreference

The "setpreference" then-action sets or updates a preferences setting of a target topic to any value, such as the value of a form field of the source topic.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *setpreference* %ENDCOLOR% | $topic/ALLOWTOPICCHANGE = $formfield(Owner) | This updates the ALLOWTOPICCHANGE preferences setting to the current topic's Owner form field |

__Target syntax:__ =target = expression=, such as =Web.SomeTopic/ALLOWTOPICCHANGE = $formfield(Owner)=

   * =target= &nbsp; - target preferences setting, defined by =topic/NAME=:
      * =topic= &nbsp; - this is =Web.TopicName= as described in the [[#RulesTableHelp][rules table help]]; tokens such as =$children= can be used.
      * =/= &nbsp; - a slash to separate topic and preferences setting name.
      * =NAME= - the name of the preferences setting.
   * =<nop>=<nop>= &nbsp; - an equal sign.
   * =expression= &nbsp; - either a value, or a source form field of format =$formfield(Name)= or =topic/$formfield(Name)=:
      * =topic= &nbsp; - this is =Web.TopicName= as described in the [[#RulesTableHelp][rules table help]]; tokens such as =$topic= can be used.
      * =/= &nbsp; - a slash to separate topic and form field.
      * =$formfield(Name)= &nbsp; - the form field.
      * The topic is optional, the source topic is assumed if missing
      * If =$formfield(...)= is missing, the value is used verbatim - useful if the expression is set dynamically by the result of %SYSTEMWEB%.TWikiVariables, such as a dynamic =%<nop>SEARCH{}%=

---+++ Then-Action: Touch

The "touch" then-action edits and saves a target topic without making any content change.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *touch* %ENDCOLOR% | !Sandbox.IfThenActionTouch | This does an edit & save of the target topic |

__Target syntax:__

   * Specify =Web.TopicName=, or a comma-space delimited list, such as =Web1.Topic1, Web2.Topic2=.
   * Tokens such as =$parent= can be used as well, as documented in the [[#RulesTableHelp][rules table help]].

---+++ Then-Action: View

The "view" then-action views a target topic. The primary purpose is to refresh a topic cache, or a persistent [[VarSET][SET]] variable embedded in a topic. The topic is viewed synchronously, e.g. it is blocking until the topic view has rendered.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *view* %ENDCOLOR% | !Sandbox.IfThenActionView | This does a normal topic view |

__Target syntax:__

   * Specify =Web.TopicName=, or a comma-space delimited list, such as =Web1.Topic1, Web2.Topic2=.
   * Tokens such as =$parent= can be used as well, as documented in the [[#RulesTableHelp][rules table help]].

---+++ Then-Action: !ViewDaemon

The "viewdaemon" then-action views a target topic asynchronously. The primary purpose is to refresh a slow topic that is cached, or has a persistent [[VarSET][SET]] variable embedded in the topic. The topic is viewed asynchronously, or non-blocking, e.g. it does not slow down the current process. It starts a daemon process to handle the topic view, and returns immediately.

%X% __Restriction:__ This feature does not work on a native TWiki installation on Windows. It works fine on Linux based TWiki installations, including a TWiki-VM that runs in a VMware environment on a Windows server.

__Example if-then-action rule:__

| *If* | *Source* | *Then* | *Target* | *Comment* |
| save | !Sandbox.IfThenActionTest | %RED% *viewdaemon* %ENDCOLOR% | !Sandbox.IfThenActionViewDaemon | This does a daemon view, e.g. is non-blocking |

__Target syntax:__

   * Specify =Web.TopicName=, or a comma-space delimited list, such as =Web1.Topic1, Web2.Topic2=.
   * Tokens such as =$parent= can be used as well, as documented in the [[#RulesTableHelp][rules table help]].

#DevInfo
---++ Info For Developers

You can ignore this section unless you want to enhance the plugin.

%TWISTY{
 mode="div"
 showlink="Show details %ICONURL{toggleopen}% "
 hidelink="Hide details %ICONURL{toggleclose}% "
}%

---+++ IFTHEN Variable

This plugin handles the =%<nop>IFTHEN{}%= variable. At this time it is only used to define the "if" and "then" picklists in the edit table of the if-then-action rules topic:

   * =%<nop>IFTHEN{if-actions}%= - returns the "if-action" list: <tt>%IFTHEN{if-actions}%</tt>
   * =%<nop>IFTHEN{then-actions}%= - returns the "then-action" list: <tt>%IFTHEN{then-actions}%</tt>

<div style="display: none;">
NOTE: This defines the edit table format of the if-then-action rules table, DO NOT REMOVE!
%STARTSECTION{ifThenEditTable}% format="| select, 1, , %IFTHEN{if-actions}% | text, 50 | select, 1, , %IFTHEN{then-actions}% | text, 50 | text, 50 |" %ENDSECTION{ifThenEditTable}%
</div>

---+++ Then-Action Classes

The then-actions are defined by classes that are auto-discovered. The base class is =TWiki::Plugins::IfThenActionPlugin::ThenAction=. All then-action classes are located in =lib/TWiki/Plugins/IfThenActionPlugin/ThenAction/=, such as =TWiki::Plugins::IfThenActionPlugin::ThenAction::View= for the "view" then-action. The name of the then-action is the lowercase class name. To create a new then-action, start by cloning one of the existing classes.

The Then-Action class has a method to handle the then-action:

<blockquote>
=$this-&gt;handleAction( $web, $topic, $text, $meta, $target )=

   * =$web=:    Name of source web
   * =$topic=:  Name of source topic
   * =$text=:   Text of source topic, possibly undef
   * =$meta=:   Metadata of source topic, possibly undef
   * =$target=: Target string
   * Return:    none
</blockquote>

The =handleAction= method is expected to call the =expandTopics= method to expand topics in the target string. That method returns an array of hash references. Loop through that array to handle all target topics.

<blockquote>
=$this-&gt;expandTopics( $sWeb, $sTopic, $sMeta, $target, $hasAccessor ) -&gt; <nop>@webTopics=

   * =$sWeb=:   Name of source web, used to normalize the !Web.TopicName of the target topic
   * =$sTopic=: Name of source topic, used to expand tokens
   * =$sMeta=:  Metadata of source topic, used to expand tokens
   * =$target=: Comma-space list of items with topics & tokens. Topics are normalized to !Web.TopicName. Non-existing topics are removed. The following tokens are expanded:
      * =$topic=: name of source topic
      * =$parents=: parent trail, up to 64 parents up; item is removed if none
      * =$parents(5)=: parent trail, up to 5 parents up; item is removed if none
      * =$parent=: topic parent; item is removed if none
      * =$parent(5)=: the 5th parent up in the parent trail; item is removed if none
      * =$children=: expands to all direct children; item is removed if none
      * =$children(5)=: expands to all children recursively 5 levels deep; item is removed if none
      * =$children(10 CID-*)=: expands to all children starting with CID-* recursively 10 levels deep
     %BR% Example target:  =Web.SomeTopic, !Web.NotExistingTopic, !Web.$parent, !Web.$children=
     %BR% Example output: =Web.SomeTopic, !Web.ItsParent, !Web.ItsChild1, !Web.ItsChild2, !Web.ItsChild3=
   * =$hasAccessor=: '1' if items may contain accessors like =/formfield(Status)=; accessors are extracted and returned.
     %BR% Example: =Web.SomeTopic/formfield(Status)=
   * Return: =@webTopics=: Array of hash references
     Example: =( { w => 'web1', t => 'topic1', a => 'formfield(Status)' }, { w => 'web2', t => 'topic2', a => '' }, ... )=
</blockquote>

%ENDTWISTY%

---++ Plugin Installation &amp; Configuration

You do not need to install anything on the browser to use this plugin. These instructions are for the administrator who installs the plugin on the TWiki server.

%TWISTY{
 mode="div"
 showlink="Show details %ICONURL{toggleopen}% "
 hidelink="Hide details %ICONURL{toggleclose}% "
}%

   * For an __automated installation__, run the [[%SCRIPTURL{configure}%][configure]] script and follow "Find More Extensions" in the in the __Extensions__ section.
      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.

   * Or, follow these __manual installation__ steps:
      * Download the ZIP file from the Plugins home (see below).
      * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
        | *File:* | *Description:* |
        | ==data/TWiki/IfThenActionPlugin.txt== | Plugin topic |
        | ==data/TWiki/IfThenActionRulesTemplate.txt== | If-then-action rules template topic |
        | ==data/Sandbox/IfThenActionEmailTemplate.txt== | E-mail template test topic |
        | ==data/Sandbox/IfThenActionForm.txt== | Test topic |
        | ==data/Sandbox/IfThenActionSetFormField.txt== | Test topic |
        | ==data/Sandbox/IfThenActionTest.txt== | Test topic |
        | ==data/Sandbox/IfThenActionTouch.txt== | Test topic |
        | ==data/Sandbox/IfThenActionView.txt== | Test topic |
        | ==data/Sandbox/IfThenActionViewDaemon.txt== | Test topic |
        | ==pub/TWiki/IfThenActionPlugin/diagram.png== | Image file |
        | ==lib/TWiki/Plugins/IfThenActionPlugin.pm== | Plugin Perl module |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/Config.spec== | Configuration spec file |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/Core.pm== | Plugin core module |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/ThenAction.pm== | Then-action base class |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/ThenAction/SetFormField.pm== | Then-action "setformfield" class |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/ThenAction/Touch.pm== | Then-action "touch" class |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/ThenAction/View.pm== | Then-action "view" class |
        | ==lib/TWiki/Plugins/IfThenActionPlugin/ThenAction/ViewDaemon.pm== | Then-action "viewdaemon" class |
      * Set the ownership of the extracted directories and files to the webserver user.

   * Plugin configuration:
      * Run the [[%SCRIPTURL{configure}%][configure]] script and enable the plugin in the __Plugins__ section.

   * Test if the configuration is successful:
      * Visit IfThenActionRulesTemplate, click on "create this topic", then save the topic. This will create <nop>%USERSWEB%.IfThenActionRules.
      * Visit [[Sandbox.IfThenActionTest]] and click on "Update this topic" - the counters should increase.

%ENDTWISTY%

#PluginInfo
---++ Plugin Info

   * Set SHORTDESCRIPTION = Execute if-then actions on topic view, save, file upload, and user registration, with rules defined in a topic

%TABLE{ tablewidth="100%" columnwidths="170," }%
|  Author: | TWiki:Main.PeterThoeny, [[http://twiki.org/][TWiki.org]] |
|  Copyright: | &copy; 2015 Alba Power Quality Solutions. %BR% &copy; 2015 Wave Systems Corp. %BR% &copy; 2015-2021 TWiki:Main.PeterThoeny %BR% &copy; 2015-2021 TWiki:TWiki.TWikiContributor |
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Sponsor: | Alba Power Quality Solutions; [[http://www.wave.com/][Wave Systems Corp.]] |
|  Version: | 2021-03-25 |
%TWISTY{
 mode="div"
 showlink="Show Change History %ICONURL{toggleopen}%"
 hidelink="Hide Change History %ICONURL{toggleclose}% "
}%
%TABLE{ tablewidth="100%" columnwidths="170," }%
|  2021-03-25: | TWikibug:Item7927: Copyright update to 2021 |
|  2019-01-23: | TWikibug:Item7851: Fix error message |
|  2017-11-15: | TWikibug:Item7821: Fix incorrect log message when "setpreference" then-action is used |
|  2017-08-27: | TWikibug:Item7821: New "setpreference" then-action to set or update a topic preferences setting |
|  2016-01-14: | TWikibug:Item7708: Copyright update to 2016 |
|  2015-05-25: | TWikibug:Item7630: New "attachsection" then-action to attach the content of a section as a file attachment |
|  2015-05-02: | TWikibug:Item7630: New "action" if-action on IFTHEN{action} variable |
|  2015-04-23: | TWikibug:Item7630: Update diagram |
|  2015-04-21: | TWikibug:Item7630: Add ifthenaction log entries in TWiki logs |
|  2015-04-20: | TWikibug:Item7630: Small code change; doc fixes |
|  2015-04-16: | TWikibug:Item7630: New "view" if-action on topic view; check access permission in "setformfield" and "touch" then-actions; ability to disable if-actions and then-actions |
|  2015-04-15: | TWikibug:Item7630: New "email" then-action to send an e-mail based on a template; new "register" if-action on user registration; the Source field in the If-Then-Action Rules Table can be a !Web.TopicName, or a list of topics |
|  2015-04-08: | TWikibug:Item7630: Expand TWiki Variables in Source and Target; support any value (not just $formfield(...)) in a setformfield expression; prevent recursive if-then-actions, e.g. a save action does not trigger another save action |
|  2015-04-06: | TWikibug:Item7630: New "setformfield" then-action to update a form field of a target topic; new "touch" then-action to edit & save a target topic; use login user for "view" and "viewdaemon" then-actions; add configure spec |
|  2015-04-05: | TWikibug:Item7630: Expand tokens =$children=, =$children(n)=, =$children(n CID-*)= in target |
|  2015-04-04: | TWikibug:Item7630: Expand tokens =$parents=, =$parents(n)=, =$parent=, =$parents(n)= in target |
|  2015-04-03: | TWikibug:Item7630: Possible to specify a comma-space list of topics as the target; add support for "upload" if-action; improve developer docs |
|  2015-04-02: | TWikibug:Item7630: Initial version of !IfThenActionPlugin |
%ENDTWISTY%
%TABLE{ tablewidth="100%" columnwidths="170," }%
|  TWiki Dependency: | $TWiki::Plugins::VERSION 1.2, BackupRestorePlugin, SetGetPlugin, SpreadSheetPlugin (all plugins are pre-installed) |
|  CPAN Dependencies: | none |
|  Other Dependencies: | none |
|  Perl Version: | 5.008 |
|  [[TWiki:Plugins.Benchmark][Plugin Benchmark]]: | %SYSTEMWEB%.GoodStyle nn%, %SYSTEMWEB%.FormattedSearch nn%, %TOPIC% nn% |
|  Home: | http://TWiki.org/cgi-bin/view/Plugins/IfThenActionPlugin |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/IfThenActionPluginDev |
|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/IfThenActionPluginAppraisal |

__Related:__ IfThenActionRulesTemplate, Sandbox.IfThenActionTest, Sandbox.IfThenActionEmailTemplate, Sandbox.IfThenActionForm, Sandbox.IfThenActionSetFormField, Sandbox.IfThenActionTouch, Sandbox.IfThenActionView, Sandbox.IfThenActionViewDaemon, %SYSTEMWEB%.TWikiPlugins

%META:FILEATTACHMENT{name="diagram.png" attachment="diagram.png" attr="h" comment="" date="1429813435" path="diagram.png" size="30246" user="TWikiContributor" version="1"}%
