That broke it 🙁 After I put the encounter on hold and re-open I get the same error I started with.
Ready to throw my hands up on this one!! When I had tested it earlier I had it as the last component of my encounter type. It works as expected there. However, if I move it to be in the middle of the encounter, between forms, it only works the first time the encounter is opened. Once I put it on hold I get the FUNCTION DEFINITION IS NOT EXECUTABLE error.
Lee was able to assist me with fixing this by adding the function in VFE to the initial form in the encounter. Works perfectly!! Big Shout Out to Lee for his willingness to help trouble shoot my problems over the last few weeks!!
To close the loop on this question, I contacted Jessica directly and, after review, we performed the following steps to overcome initialization and global scope limitations in the EMR.
The challenge was that Jessica wanted a custom medication list translation inserted in a specific location between two CCC forms. Since these forms cannot be edited, a workaround was required. While use of a data symbol proved functional, use of a custom function was not reliable via inserted text component due to placement within the update (it worked fine at the end and I suspect the beginning, but not the middle.
1) Moved the function from the text component to an existing form in the update that was editable locally. Note that this custom form is the first form in the update, which ensures that it would always be initialized.
2) In the same form, we assigned the function call to a global variable.
3) In the text component, we referenced only the global variable (plus header), producing the desired list.
Result: The custom list translation was able to be inserted where desired and behaved as a watcher expression within the update.