Tags:
create new tag
, view all tags

IfThenActionPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on IfThenActionPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please file bug reports in the IfThenActionPlugin bug database.

Feedback on IfThenActionPlugin

Initial version is now uploaded. Enjoy!

-- Peter Thoeny - 2015-04-02

I added a number of additional features:

  • New "upload" if-action
  • New "setformfield" then-action to update a form field of a target topic
  • New "touch" then-action to edit & save a target topic
  • Expand tokens $children, $children(n), $children(n CID-*), $parents, $parents(n), $parent, $parents(n) in target
  • Possible to specify a comma-space list of topics as the target
  • Improved developer docs

Let me know if you have some additional needs.

Let us know how you use this plugin to automate your workflow!

-- Peter Thoeny - 2015-04-07

Idea for enhancement:

  • In the source column, allow conditions, such as "if form field X changed", or "if URL parameter Y is Z", etc.
  • Expand TWiki variables such as CALCULATE in source column and target column to dynamically define content?
  • New "view" if-action for topic view. Useful? This can be very noisy, and could impact performance.
  • New "change" if-action to take action if a form field of a source topic changed. This is difficult to implement.
  • New "register" if-action to take action on user registration.
  • New "email" then-action to send an e-mail based on a template.
  • New "update" then-action to update topic text with a search/replace regular expression rule, such as Target: Web.SomeTopic/$replace("from", "to")
  • New "rename" then-action to rename a target topic.
  • New "copy" then-action to copy (duplicate) a target topic.
  • New "delete" then-action to delete a target topic.
  • New "redirect" then-action to redirect to a target topic or URL.

What else?

-- Peter Thoeny - 2015-04-07

Here are specific use cases at two client TWiki sites:

1. TWiki applications requirements management:

The requirements are arranged in a tree hierarchy. Each requirement has a "Status" field.

Need: If a status field at a higher level is updated, all status fields of dependent requirements need to be updated recursively.

Solution: If-then-action rule to update children topic's Status field:

If Source Then Target Comment
save WCKE.WRqm* setformfield $children(32 WRqm*)/$formfield(Status) = $formfield(Status) This updates all children's Status form field to the current topic's Status form field value

2. TWiki applications for parts management:

The parts database has 20K parts. A form with an autoselect parts field is too slow if done with a dynamic query on all parts. To get the required performance, a PartsData topic is created to cache the parts data. The topic has a dynamic query that generates the JSON object needed for autocomplete, and stores it in a persistent SET variable with remember="1" using SetGetPlugin. A named section in PartsData can be used to GET the persistent variable.

Need: Update the JSON object so that it remains in sync whenever a part topic is updated.

Solution: On save of a part topic, do a topic view on PartsData to refresh the JSON object. The topic view is done asynchronously (e.g. non-blocking) so that the topic save is not slowed down. If-then-action rule:

If Source Then Target Comment
save Parts.PID-* viewdaemon Parts.PartsData This does a non-blocking view on the parts data topic to update the JSON object in the persistent SET variable

-- Peter Thoeny - 2015-04-07

I enhanced the plugin:

  • Support conditions for Source topics (by expanding TWiki Variables). Useful to dynamically decide if action should be taken or not. Such as:
    • "if 'Review Date' form field is older than 12 month, set 'Needs Review' form field",
    • "if URL parameter Y is Z, do action...", etc.
  • Prevent recursive if-then-actions, e.g. a save action does not trigger another save action.

The "Target" does not yet expand TWiki Variables.

-- Peter Thoeny - 2015-04-08

The "Target" does now expand TWiki Variables as well.

In addition, the target = expression in a setformfield then-action, the expression can be any value, and does not need to be of form $formfield(...).

-- Peter Thoeny - 2015-04-09

I enhanced the plugin again:

  • The Source field in the If-Then-Action Rules Table can be a Web.TopicName, or a list of topics.
  • New "register" if-action on successful user registration.
  • New "email" then-action to send an e-mail based on a template.

-- Peter Thoeny - 2015-04-15

I enhanced the plugin again:

  • New "view" if-action on topic view.
  • Check access permission in "setformfield" and "touch" then-actions.
  • Ability to disable if-actions and then-actions in configure.

-- Peter Thoeny - 2015-04-16

I enhanced the plugin again:

  • Add ifthenaction log entries in TWiki logs.
  • Small code change; doc fixes.

-- Peter Thoeny - 2015-04-21

I enhanced the plugin again:

  • New "action" if-action, triggered by %IFTHEN{action}% variable.
  • Updated diagram.

-- Peter Thoeny - 2015-05-03

Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2015-05-03 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.