Invoke a rule from code

Forums Classic DFFS Invoke a rule from code

Viewing 3 reply threads
  • Author
    Posts
    • #19954
      Ivan Wilson
      Participant

      Is there any way to run a rule from within a JavaScript function?

      Also, can I suggest adding an option to run the reverse of a rule using syntax like ~MyRuleName.

    • #19999
      Alexander Bautz
      Keymaster

      You can trigger a rule from code like described in the top of the rules tab:

      spjs.dffs.triggerRule(["IndexOrFriendlyNameOfRule"]);

      This will run the rule as “true”, but I’ll see what I can do about letting you trigger the reverse in a future version.

      Alexander

    • #20033
      Ivan Wilson
      Participant

      Thanks Alexander, I thought I had seen that option somewhere, but couldn’t remember where. Would it be worthwhile adding this to the user manual?

      Is there a way to check the last execute status of a rule in code?

      Ivan

    • #20047
      Alexander Bautz
      Keymaster

      You find it in the rules tab if you expand the “Trigger rules manually” section.

      To see the status of a rule in your custom code, you can use this snippet:

      spjs.dffs.data.ruleIndexObj.YOUR_RULE_FRIENDLY_NAME_OR_INDEX

      Alexander

Viewing 3 reply threads
  • You must be logged in to reply to this topic.