Call Javascript Method with parameter

Forums Dynamic Forms for SharePoint Call Javascript Method with parameter

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 3 weeks, 5 days ago.

  • 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

You must be logged in to reply to this topic.