"IDVault is not defined" Error in Custom Function – IDM 4.9 Form Builder

I am building a form in "Form Builder", IDM 4.9, but I am encountering the following issue...

I am trying to create a function where I need to perform some IDVault.get calls, but when I call the function, I get the following error: "IDVault is not defined".

If I call the same IDVault inside the CustomDefaultValue function of a field, it works. But why doesn’t it work in a user-created function?

I will provide some screenshots below for better understanding.

SS1: Screenshot 1

SS2: Screenshot 2

SS3: Screenshot 3

Labels:

Identity Manager
  • 0

    hi, I expect the problem is with how "externalScripts" are used by the formio engine, I believe that those methods are declared somehow different and the ones defined in "externalScrips" are not given access to the same set of modules/libraries. IDVault is an addon on top of form.io, so maybe our NetIQ colleagues made it available only to some of the form.io functionality. 
    I bet if you define the function inside the one presented on SS2, all will work thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures

  • 0  

    Hi,

    I have also encountered this problem. When I use external functions, I usually call them from a “customDefaultValue”, which allows me to pass the corresponding variables to the function as parameters (e.g. 'IDVault', 'utils', 'instance').

    A colleague once told me that you can solve this by defining the variable ('var IDVault;') at the very beginning (outside a function) in the FormBuilder JavaScript editor.
    However, I have never tried this myself and I am not sure whether the variable declaration is correct or whether I am confusing something.

    BR

    Tobias

  • Suggested Answer

    0

    Hi,

    You can add IDVault as a variable in your custom function and pass it along when you call the function:

    function change___subheading_1(IDVault){

         IDVault.get('.....')

         ....

    }


    function fldCalculaValoresRecipient_CustomDefaultValue(){

        change___subheading_1(IDVault)

    }

    Best regards,

    Philip

  • 0 in reply to 

    It worked this way, thank you very much.