- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 06:53 AM
Hello,
I have configured a data resource to fetch a payload via REST api. I can see the data is being successfully fetched. I was hoping to achieve the following,
Fetch data resource -> format via client script -> set formatted data as client state property
On the data resource I was able to find the "Data Fetch Succeeded" event, which I assume is where I'd want to assign a formatting client script. However, I wasn't sure how to reference that data payload in the specified script.
Solved! Go to Solution.
- Labels:
-
UI Builder : Next Experience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:24 AM
Hi @TFischer ,
in your client script which is attached to "Data Fetch Succeeded", access your data like this:
api.data.<name of your DR that should return result>.<variable name that you have defined in your output schema in DR record>
as an example:
const clientData = api.data.getClinetDataFromApi.result;
console.log('clientData', clientData);
// transform your data
If my answer helped you in any way, please then mark it as helpful or correct. This will help others finding a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:24 AM
Hi @TFischer ,
in your client script which is attached to "Data Fetch Succeeded", access your data like this:
api.data.<name of your DR that should return result>.<variable name that you have defined in your output schema in DR record>
as an example:
const clientData = api.data.getClinetDataFromApi.result;
console.log('clientData', clientData);
// transform your data
If my answer helped you in any way, please then mark it as helpful or correct. This will help others finding a solution.