UI Action cancel proposal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:07 PM
Hi,
I want to cancel a Standard Change Proposal without having to populate the mandatory fields e.g. Description, Business Justification and Sample Change Requests. For this i have modified the cancel proposal ui action as below. On clicking cancel proposal fields are becoming non mandatory but proposal is not getting cancelled. Can someone please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:44 PM
Hi @Community Alums
I am able to do with OOTB UI Action
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:56 PM
Hi @Community Alums
Could you try bellow code once:
function goToNew() {
// Set mandatory fields to false
var fields = [
'category',
'template_name',
'short_description',
'assignment_group',
'description',
'business_justification',
'change_requests'
];
fields.forEach(function(field) {
g_form.setMandatory(field, false);
});
// Submit the form with the specified action
gsftSubmit(null, g_form.getFormElement(), 'std_change_proposal_cancel');
}
if (typeof window == 'undefined') {
serverSideCodeToRun();
}
function serverSideCodeToRun() {
try {
gs.info('Cancelling Standard Change Proposal: ' + current.getUniqueValue());
// Call the method to cancel the standard change proposal
new StdChangeUtils().cancelStandardChangeProposal(current.getUniqueValue());
// Redirect to the current record
action.setRedirectURL(current);
} catch (e) {
gs.error('Error cancelling Standard Change Proposal: ' + e.message);
}
}
check the logs for errors or information that might guide further troubleshooting.
i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
rajesh