Uncaught ReferenceError Function is not Defined HELP

Hello Eveyone

I have a Javascript code placed in an element
image


(Sorry dont know how to paste it fully)

When it loads and gets dynamically updated, the DOM fully loaded and parsed Log gets logged into the console

and works good, the script code is fully loaded and the dynamic data get s updated correctly

But when I use the Run Javascript action on a button workflow running rotateImages();
I then get an Uncaught ReferenceError: rotateImages is not defined
The HTML Element is on iframe (thats the only way it will work so far) but still gets me the undefined error

What am I doing wrong?

@vini_brito I am sure you have done something like this as you mentioned in the PDF Conjurer thread, do you have any idea?

If you’re running this code in an HTML element as an iFrame, your function is only accessible within the scope of that iFrame, the parent window won’t have access.

Hey Tim, thanks for the response

I tried not using the iframe before but absolutely nothing happens, wouldnt log anything in the console

Do you have an idea of how to get this working?

Looks like you’re wrapping your function in an event listener for DOMContentLoaded.

This event likely fires before the event listener is added when running on the page.

Putting it in the iFrame makes it fire properly, since the DOMContentLoaded event is actually referring to the iFrame instead of the page.

You should just use a regular function instead of an event listener trigger.

Oh that actually worked! I everything to work perfectly in the console, I can actually see the files being generated in base64 strings in the console

But when the Javascript to Bubble element trigger gets called I get blank values

This is my code now after all the tweaking…

My goal is to take those images and update the database but I can’t find a way to get the list of texts base64 or urls for the newly generated images back to javascript to bubble element

This is the element’s setup. Am I doing something wrong here or what do you think would be the right way to get the data?
image
image

This topic was automatically closed after 70 days. New replies are no longer allowed.