I made a prompt that allow an action to be triggered on page load.
I attempted to create a prompt that allows the AI component to perform an action on load after a delay of 100 ms. While I couldn’t get it to work with the provided delay value, it still enables us to make the AI execute a custom action upon page load.
Here is the prompt :
1. In the **DATA** section, define only the `Delay` property with a milliseconds value.
2. On component load, automatically retrieve the `Delay` property. If the property is not set, use a default value of 100 milliseconds.
3. Use the retrieved `Delay` property to start a `setTimeout` function.
4. After the specified delay:
a. Dispatch the **Show Notification** action from the **action** section.
5. The **Show Notification** action must be defined in the **action** section.
6. There will be no visual elements, start, or stop button; the action will trigger automatically without any manual intervention.
7. Ensure that all code runs within the component's secure context to avoid violations of Content Security Policy (CSP) and prevent loading external scripts.
And this is what it looks like :
or you could use a helper table :
or
Here’s a demo:
Original Post :