Script not working in UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2024 05:12 AM
I am facing an issue while running the script in UI action. The client side script is executed but the server side script is not getting executed even if i use gsftSubmit().
Here is the code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 06:22 AM
Please make sure client checkbox button is true on the UI action also in OnClick field you should call alertUser()
. Further please apply some log in createChildIncident() function to check where code is getting failed.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:56 AM
Hello @Akshat24042404, please try below tried and tested code.
function alertUser() {
if (confirm("Are you sure you want to create a child incident of current incident?")) {
alert("your record is created");
gsftSubmit(null, g_form.getFormElement(), 'create_incident');
}
}
if(typeof window == 'undefined')
createChildIncident();
function createChildIncident() {
var g = new GlideRecord('incident');
g.initialize();
g.caller_id = current.caller_id;
g.parent_incident = current.sys_id;
g.short_description = current.short_description;
g.insert();
action.setRedirectURL(current);
}
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers!
Thanks and Regards,
Abhijeet Pawar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 05:20 AM
Hello @Abhijeet_Pawar I am working on the same requirement above mentioned code is working fine for me.
Thank You,