Announcement

Collapse
No announcement yet.

Code Template Library ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code Template Library ?

    We started to use the new Code Template libraries.
    Now my channel says the function is not defined?

    ReferenceError: "myfunc" is not defined.


    What else do we need to do?

  • #2
    does your function have a return statement?
    How are you calling the function...inside a transformer?
    I think an example would help but possibly how you are calling it in the transformer isn't quite complete...

    Comment


    • #3
      I just had this same issue. The fix for me was to click on the library that contains the function, and then check the boxes to the right for the channels that I wanted to have access to the library.

      Comment


      • #4
        Have you included that library into your channel (dependencies in channel summary tab)? And made sure the library is available in the right context?

        Comment


        • #5
          Thanks. I did not notice the Dependencies button.
          Now it makes more sense.

          Comment


          • #6
            There are a couple levels of restriction when it comes to code templates / libraries.

            First, you "include" code templates with channels at the library level. So edit the library, and to the right-hand side you pick the channels that you want to include it on. You can also check "New Channels" to ensure that the library is automatically included on new channels you create without having to go back and edit the library every time.

            Second, on the code template itself you can choose exactly what contexts to include the code template on, again on the right-hand side. By default, a code template is included on all source/destination connector-level scripts (like filters/transformers), which is the same as it was in 3.2.2 and earlier.

            So if you're having issues using a code template, it could be because you haven't included the right context on the code template, or it could be because you haven't included the right library on the channel you're working on.
            Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

            Nicholas Rupley
            Work: 949-237-6069
            Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


            - How do I foo?
            - You just bar.

            Comment


            • #7
              It seems the select All in Channel Dependencies does not work, it does not save even after you click OK and save.

              Comment


              • #8
                Good catch, I've created an issue for that: MIRTH-3852
                Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

                Nicholas Rupley
                Work: 949-237-6069
                Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


                - How do I foo?
                - You just bar.

                Comment

                Working...
                X