UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 03:02 AM
Hi team ,
i have created the UI action button on RITM .Requirement is after clicking the UI action button we have to show the popup 'comments need to be added to perform this action ' after filling the comments only UI action need to be performed can anyone help me in the script how to achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 03:37 AM
The information you provided is not enough. What does the entire use case look like? What are you trying to achieve? Why do you have to use a UI action? What exactly is it supposed to do? And where exactly do you expect the user to write comments?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 03:50 AM - edited 08-16-2024 04:32 AM
Hello @shabbir9 ,
The requirement is that the comments are to be filled before clicking the UI Action,
So, just make the comments Mandatory and add an Info message when the UI Action is clicked.
If you really require the popup, let me know.
I have done similarly on the Incident form.
If this information helps you, kindly mark it as Helpful or correct.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 01:38 AM
Thank you for your response @Najmuddin Mohd .yes pop is required could you please share the code my requirement is similar that you have shown in the screen shot after clicking the ui action i have to show the popup same you have mentioned in the above comment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 02:17 AM
Hi @shabbir9 ,
UI Action:
UI Pages.
Navigate to System UI > UI Pages. Create New.
name: add_comments
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">
<g:evaluate var="jvar_incident_id" expression="RP.getWindowProperties().get('incident_id')" />
<g:ui_form>
<p>
<label for="reason"> Additional comments:
</label>
<g:ui_multiline_input_field name="reason" mandatory="true" style="width: 100%" />
<div id="error_reason" style="background-color:pink;text-color:red;border:1px red;visibility:hidden">Please add the additional comments</div>
</p>
<input type="hidden" name="incident" id="incident" value="${jvar_incident_id}" />
<p>
<g:dialog_buttons_ok_cancel ok="return validateForm();" />
</p>
</g:ui_form>
</j:jelly>
Client script:
function validateForm(){
var theReason = gel("reason").value;
if(theReason.trim() == ""){
gel("error_reason").style.visibility = "visible";
return false;
}
else
{
return true;
}
}
Processing script:
var urlOnStack = GlideSession.get().getStack().bottom();
gs.log(reason, "Reject Solution");
if (!reason.nil() && incident != '') {
var grIncident = new GlideRecord('incident');
grIncident.get(incident);
grIncident.state = IncidentState.IN_PROGRESS;
grIncident.setDisplayValue("comments", reason);//comments = reason;
grIncident.update();
}
else {
gs.addErrorMessage('Please fill in the additional comments.');
}
response.sendRedirect(urlOnStack);
First do it on the Incident form itself, even though your requirement is on sc_req_item, so that you will understand the output. Later you configure the requirement.
If this information helps you, kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.