Confirmation Message with Yes or No options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2024 10:40 PM - edited 11-05-2024 10:40 PM
Hello ServiceNow experts! I have this Client Script that has a confirmation message showing to copy fields from parent to child case. This confirmation message has options to select: OK (copy) and Cancel (not to copy). Please help in modifying to change the OK to Yes and Cancel to No. Here's the client script:
function onLoad() {
// Check if the form is a new record
if (g_form.isNewRecord()) {
// Clear the confirmation flags for new cases
sessionStorage.removeItem('confirmationShown');
sessionStorage.removeItem('descriptionConfirmationShown');
var parentId = g_scratchpad.parentSysId;
// Show confirmation for short description if not already shown
if (parentId) {
var confirmationShown = sessionStorage.getItem('confirmationShown');
if (!confirmationShown) {
var answer = confirm("Do you want to copy the short description from the parent case?");
if (answer) {
var ga = new GlideAjax('GetParentFields');
ga.addParam('sysparm_name', 'getShortDescription');
ga.addParam('sysparm_parent_id', parentId);
ga.getXMLAnswer(function(response) {
if (response) {
g_form.setValue('short_description', response);
}
});
}
sessionStorage.setItem('confirmationShown', 'true');
}
// Show confirmation for description if not already shown
var descriptionConfirmationShown = sessionStorage.getItem('descriptionConfirmationShown');
if (!descriptionConfirmationShown) {
var descriptionAnswer = confirm("Do you want to copy the description from the parent case?");
if (descriptionAnswer) {
var gaDesc = new GlideAjax('GetParentFields');
gaDesc.addParam('sysparm_name', 'getDescription');
gaDesc.addParam('sysparm_parent_id', parentId);
gaDesc.getXMLAnswer(function(response) {
if (response) {
g_form.setValue('description', response);
}
});
}
sessionStorage.setItem('descriptionConfirmationShown', 'true');
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 05:15 AM
Can somebody help me please...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 05:34 AM
I got it working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 08:05 AM
Hi, what did you do to get this working? Thanks