Call Javascript Method with parameter

Home Forums Classic DFFS Call Javascript Method with parameter

Viewing 1 reply thread
  • Author
    Posts
    • #25441
      Joe Keyrouz
      Participant

        Hello,

        Is it possible to call a javascript method with a parameter?
        I have a method that will be called several times from several rules, and each rule is on a field and will call the JS method that will run depending on this field value
        so rule 1 for field 1 will call my method with a parameter
        rules 2 for field 2 that will call the same js method but with a different parameter

      • #25466
        Alexander Bautz
        Keymaster

          When you use a custom function triggering on a rule, the “Rule friendly name” is passed as an argument to the function. This means you can do something like this:

          function ruleCustomFunc(ruleID){
              switch(ruleID){
                  case "YourRuleID1":
                      // Do whatever you want for YourRuleID1 here
                  break;
                  case "YourRuleID2":
                      // Do whatever you want for YourRuleID2 here
                  break;
              }
          }

          Let me know how this works out.

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.