Hi. I’m using UI builder. I have a page that contains an iframe component. The URL, to an external service, for the iframe is by my page logic. The external service is a page where the user signs a contract. My page needs to know when the contract is signed, and then engage other codeless logic after signature. I am able from within the iFrame to pass a javascript message (let’s call it “completed”) to the parent window, using parent.postMessage() for example (example here: Sending messages from child iframe to parent webpage · GitHub), to indicate that the user process is completed. I know how to place custom javascript code in the parent page to listen for and receive the “completed” message. My question is: how can I from the parent page run codeless logic after receiving the “completed” message from the iFrame? Basically, how do you call codeless page code from custom javascript on a page? Also, where would you place the codeless page code that needs to run after the message is received in this use case? Thanks!
Hello @Marc_Chriqui
This is an interesting question!
I would recommend you to try to implement your own CustomComponent where you can register your own EventHandlers/Actions and use JS for Inter-Process Communications between a page and iframe.
However, I believe it can be archived without a CustomComponent:
- I do not know where/how you subscribe to events from the iframe, but I will consider that you do it somewhere in OnBeforeMount event
- as I see your main question is: How to run CodelessLogic from CustomCode block, is that correct?
First of all, you can run a CustomFunction from CustomCode block, for that you can copy Invocation Code
using the context menu and paste the code into your CustomCode
I believe you want to share some context of the page with the CustomCode, for that just pass whatever you need into the CustomCode and then pass it to the CustomFunction
Is that what you are looking for?
Regards, Vlad
Looks like a workable solution. I’ll try it and will report back. Thank you!
The solution works great. It’s nice to have a solution for calling codeless code from custom code. Love it. Thanks again!