How to hide a button once it is submitted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 11:33 PM
Hello All,
I created a button in incident form called "Send Reminder".
Once it is submitted need to hide the button, generally while refreshing it is hiding.
it is needs automatically refresh the form once submitted.
please help me on this.
Thanks,
Abdul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 01:15 AM
@SANDEEP28 as you know i already created script include for that to show in Business Hours.
I create custom field u_email_sent in incident table with type True/False.
Do i need to add the given script in UI action itself?
current.u_email_sent = true;
current.update();
action.setRedirectUrl(current);
Please correct me if i'm wrong.
Thanks,
Abdul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 01:41 AM
@Abdul333 Yes you need to add script in UI action and also append the "current.u_email_sent == false" in the condition field of UI action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 03:05 AM - edited 08-17-2023 03:07 AM
@SANDEEP28 it is working, but the thing is we need to show the button again after 2hours.
Could you please help me on this, so that after sending an email the button will be visible again after 2hours.
Thanks,
Abdul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 05:18 AM
@Abdul333 In that case, new field which you created should be of Date/time type and populate current date/time into it when email is sent. Based on that date/time present in that new field, you can write a logic of 2 hours and use in condition field of UI action.
Share you script include code here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 05:39 AM
@SANDEEP28 Please find the below Script Include.
var grSla = new GlideRecord('contract_sla');
if (grSla.get('name', incidentObj.assignment_group.getDisplayValue())) {
var gsSchedule = new GlideSchedule(grSla.getValue('schedule'));
var todayDateTime = new GlideDateTime(); //GlideDateTime object representing the current date and time.
if (gsSchedule.isInSchedule(todayDateTime)) {
return true;
}
// If the current time is within the schedule, return true.
else {
return false; // If the current time is outside the schedule, return false.
}
} else {
return false; // If no record with the given group name is found, return false.
}
} else {
return false;
}
},
type: 'IncidentReminder'
};
Thanks,
Abdul