- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 03:29 PM - edited 06-26-2025 03:55 PM
Hello,
I'm trying to make a modification to our landing page in Service Operations Workspace. Basically, we've added a user field for "nickname" and we want to use that instead of the firstName that it defaults to. I setup a local Data Resource that queries the sys_user table to get this information, but when I try to update the initialization script, it crashes when trying to read this value. If I go to the pill selector it is: data.look_up_nickname.result.nickname.value, so I've tried adding code for api.data.look_up_nickname.result.nickname.value, but it just crashes. I know the rest of the coding works, because if I hard code a name "like x = 'Smith'" then it does exactly what is expected, but only fails when trying to read from the local data resource. I've also replaced the dynamic text component with the local resource directly in the interface, so I can see that the data does exist, it's only when trying to read from the local data resource IN client script that I am having issues. Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 11:40 PM
Hi Simoes,
It seems so.
1. Create a client state "nickName".
2. Update client state with returned value when the data fetch succeeded
3. Use the client state in your landing page, this way it works async.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 08:45 AM
Can you share your JSON payload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 08:50 AM
{
"items": [
{
"id": "Greg Simoes",
"label": "name",
"value": "Greg Simoes"
},
{
"id": "Greg",
"label": "u_user_nickname",
"value": "Greg"
}
],
"result": {
"_row_data": {
"displayValue": "Greg Simoes",
"uniqueValue": "6a1045d9db43d89079bdd8f3ce961906"
},
"name": {
"displayValue": "Greg Simoes",
"value": "Greg Simoes"
},
"u_user_nickname": {
"displayValue": "Greg",
"value": "Greg"
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 08:57 AM
try, JSON.parse(api.data.look_up_nickname.result).u_user_nickname.value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 09:01 AM - edited 06-27-2025 09:08 AM
Still failed, but new error message:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
I think it's probably a timing issue that the data has not been retrieved yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 08:55 AM
Here's the Data Resource configuration, in case something there might be throwing things off