UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 02:53 AM
I want to create a UI Action on the Incident form with a form button labeled 'Show Summary'. When clicked, the button should display the Caller, Short Description, Priority, and State fields in a dialog window. Please guide me on how to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 11:06 PM
Hi Yuvaraj,
You can achieve by showing a GlideModal in your UI Action.
Your UI Action will look something like this:
function onClick() {
var gm = new GlideModal("glide_info", true, 600);
gm.setTitle("Test title");
gm.setPreference("title", "The description is:" + g_form.getValue('description'));
gm.setPreference("onPromptComplete", function() {
alert("You clicked on 'Ok'");
});
gm.render();
}
The UI action might look like this:
Which will give you a UI action like below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2024 04:35 AM
Hello @RohanK1004
Please Refer below logic
Create a ui page like below and call in ui action by using the GlideDialogWindow api and pass the sys_id by setPreference('sysparm_sys_id',g_form.getUniqueValue()) and pass the UI page name that you want to show details of the incident records.
Make the Required Changes accordingly
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide">
<g:evaluate var="sysparm_sys_id">
var sysparm_sys_id = RP.getParameterValue("sysparm_sys_id");
sysparm_sys_id;
</g:evaluate>
<g:evaluate var="jvar_record" object="true" jelly="true">
var gr = new GlideRecord("incident");
if (gr.get(sysparm_sys_id)) {
gr;
}
</g:evaluate>
<style>
td {
font-size: 8px;
text-align: center;
vertical-align: top;
}
@media print {
@page {
margin: 0;
}
}
</style>
<table style="width:100%; height:100%">
<tr>
<td>State:</td>
<td>${jvar_record.getDisplayValue('state')}</td>
</tr>
<tr>
<td>Caller:</td>
<td>${jvar_record.getDisplayValue('caller_id')}</td>
</tr>
<tr>
<td>Short Description:</td>
<td>${jvar_record.getDisplayValue('short_description')}</td>
</tr>
<tr>
<td>Priority:</td>
<td>${jvar_record.getDisplayValue('priority')}</td>
</tr>
</table>
</j:jelly>
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You