form to ui page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2023 11:16 AM
Hi all
I need to take from the form in INCIDENT the value in the field assignment_group and put the value inside the html in ui page (i have ui action between them )
How can i take from the field and put it in HTML ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2023 08:55 PM
HI @Yahav Mor ,
I trust you are doing great.
To retrieve the value from the "assignment_group" field in the INCIDENT form and place it inside the HTML code in a UI page, you can follow these steps:
- Identify the UI page where you want to display the value from the "assignment_group" field.
- Add a UI action to the relevant UI page. This UI action will be responsible for retrieving the field value and updating the HTML code.
- Define the UI action script. Here's an example script that you can modify according to your specific requirements:
// Get the assignment group field value from the current incident record
var assignmentGroup = g_form.getValue('assignment_group');
// Modify the HTML code on the UI page to include the assignment group value
var htmlElement = document.getElementById('your-html-element-id'); // Replace 'your-html-element-id' with the actual ID of the HTML element in your UI page
htmlElement.innerHTML = assignmentGroup;
- Save the UI action script and ensure it's associated with the desired UI page.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2023 09:14 PM
can you share what script have you tried so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 02:24 AM
ui action :
function openUIPage() {
var assignmentGroup = g_form.getValue('assignment_group');
var dialog = new GlideDialogWindow('testassignedto');
dialog.setTitle('USER');
dialog.setSize(450, 150);
dialog.adjustBodySize();
dialog.render();
}
UI PAGE HTML
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<table>
<g:ui_form>
<g:evaluate jelly="true" object="true" var="jvar_kparticles">
var htmlElement = document.getElementById('assignment_group');
htmlElement.innerHTML = assignmentGroup;
var kb = new GlideRecord('sys_user_grmember');
kb.addQuery('group',assignmentGroup);
var list = [];
kb.query();
while(kb.next()){
list.push(kb.getValue('user')); }
list.toString();
</g:evaluate>
<g:ui_reference name="assigned_to" id="assigned_to" table="sys_user" query="sys_idIN${jvar_kbarticles}" completer="AJAXTableCompleter" />
<div class="col-sm-9" style="margin-top:9px">
<button id="cancel_button" class="bth bth-default" onclick="onCancel()" type="button" style="margin-right:spx">
${gs.getMessage('cancel')} </button>
<button id="ok_button" class="bth bth-destructive" onclick="OK()" type="button" >
${gs.getMessage('ok')} </button>
</div>
</g:ui_form>
</table>
</j
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 02:38 AM
okay you want to show only those users in assigned to who are member of that group on form?
I shared solution for similar requirement few days ago. check that and enhance it
how to select users only part of that assignment group of that selected record in ui page
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