How to get a dynamic choiceList for a field while creating a g_modal for a CSM/FSM Workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 12:15 AM - edited ‎03-01-2024 06:05 AM
I'm creating a modal for Service case table where I have one dropdown choicelist field and other is the textarea. I defined g_scratchpad in a business rule to get all the choices for the field which I further used successfully for the classic UI. Now the question is how can I use this g_scratchpad for the Workspace client script as well??
//Workspace Client Script
//Thankyou..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 01:27 AM
Is the g_scratchpad coming undefined in workspace script?
If yes then you will have to use GlideAjax, bring the choices and then populate
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 01:32 AM - edited ‎11-06-2023 01:33 AM
No @Ankur Bawiskar, As you can see that there is an alert statement at the bottom of the script, it is showing all the required choices as an objects. I'm just unable to use it accordingly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 01:40 AM
you are saying this line is not working?
//choices: JSON.parse(g_scratchpad.resolutionCodeChoices),
If yes then it expects value in this json format
{
"choices": [
{
"value": "myValue1",
"displayValue": "myLabel2"
},
{
"value": "myValue2",
"displayValue": "myLabel2"
}
]
}
Try giving hard-coded value and if it works then send the same values in g_scratchpad variable
I have also created a blog for something similar
Populating dynamic choices in workspace form pane for choice field type
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 01:59 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader