- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 11:17 PM
I want to create a UI page which will be having a choice field and it should pop when Ui action is clicked.
On the incident form when assignment group is selected , the UI page should have choice value based on that .
I have a different table where the assignment group and its value is stored. I want this value to be mapped to UI page when assignment group is selected on incident form.
How can I achieve this??
Please help!!
Thanks,
Rahul
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 07:31 AM
Hi,
it seems you are adding the options from client script of UI page
But the link I shared relates to your question and you can create options based on iteration
Something like this
<g:evaluate var="jvar_gr" object="true">
var arr = ['1','2','3'];
arr;
</g:evaluate>
<select>
<j:forEach items="${jvar_gr}" var="jvar_val">
<option value="${jvar_val}">${jvar_val}</option>
</j:forEach>
</select>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 11:29 PM
Hi,
in the UI page HTML you can use g:evaluate tag and get all the choices stored in an array and then use j:forEach to iterate over that array
this link has solution which I shared 2 years ago; enhance it for your requirement
how to add choice options from another table dynamically on an ui page
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 06:50 AM
Hi
In the <g:evaluate> tag I have got the values inserted into array . Now how can I use that array to add values as an option to my dropdown .
In client script I tried like this but it is showing wrong values in dropdown:
var selectitem = document.getElementById("component_choice");
var myValues = document.getElementById("componentChoices");
alert(myValues);
for(var i in myValues){
var option = document.createElement("option");
option.text = i;
option.value = myValues[i];
selectitem.add(option);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 07:31 AM
Hi,
it seems you are adding the options from client script of UI page
But the link I shared relates to your question and you can create options based on iteration
Something like this
<g:evaluate var="jvar_gr" object="true">
var arr = ['1','2','3'];
arr;
</g:evaluate>
<select>
<j:forEach items="${jvar_gr}" var="jvar_val">
<option value="${jvar_val}">${jvar_val}</option>
</j:forEach>
</select>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 03:51 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.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader