- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 11:17 AM
I am pretty new to UI action
Can someone help on how can I use the below script in a UI action- form button, instead of an onsubmit client script. I need to check the current record has an attachment before the script runs
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 11:36 AM
Hello @Anna_Servicenow
- Create a new record in sys_ui_action table.
- Fill the details as shown in the screenshot below and modify as required.
Screenshot1:
Screenshot2:
Script:
function showDetails() {
var systemId = g_form.getUniqueValue();
var ga = new GlideAjax('AttachmentParserScoped');
ga.addParam('sysparm_name', 'getExcelInfo');
ga.addParam('sysparm_sys_id', systemId);
ga.getXMLAnswer(showDetails);
function showDetails(answer) {
alert(answer);
}
}
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 11:36 AM
Hello @Anna_Servicenow
- Create a new record in sys_ui_action table.
- Fill the details as shown in the screenshot below and modify as required.
Screenshot1:
Screenshot2:
Script:
function showDetails() {
var systemId = g_form.getUniqueValue();
var ga = new GlideAjax('AttachmentParserScoped');
ga.addParam('sysparm_name', 'getExcelInfo');
ga.addParam('sysparm_sys_id', systemId);
ga.getXMLAnswer(showDetails);
function showDetails(answer) {
alert(answer);
}
}
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar