- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:02 AM
Hello,
I have built my own UI Component (ChatGPT conversation UI) and the component has an Event/Action (CHATGPT#COMPLETED) that lets me know that the prompt/response has completed. This is installed on my instance and I am pleased is working.
I have added an Event Handler from "CHATGPT#COMPLETED" to my Client Script called "Process Chat". The stub for this is
function handler({
api,
event,
helpers,
imports
}) {
}
In "Process Chat", I want to update several fields (lets say FIELD1 and FIELD2) on my form but I cannot find a way to do update the form fields with new data- to set FIELD1 to variable1 and FIELD2 to variable2. The form (called form) is controlled by a form controller (called record).
I can access the controller via "api.data.record"
I can access the form via "api.data.form"
From the documentation, I've tried "api.data..setValue(Object payload)" and "api.emit(String eventName, Object payload)".
But I have no luck finding a method to update the form fields.
How can update the form fields with new data?
Dave
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 03:58 AM
I found a solution. Wire the output of your component (or other UI component) to the Form's Set User Input Value. Switch the mode to "Script" and write script to set the form field you want to set. Repeat for each field that needs updating. I have sample snippet below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 03:58 AM
I found a solution. Wire the output of your component (or other UI component) to the Form's Set User Input Value. Switch the mode to "Script" and write script to set the form field you want to set. Repeat for each field that needs updating. I have sample snippet below: