How to add Rejection reason ( on UI pop up ) to the Comments field and set Approval State to Reject?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 10:34 PM
Hi All,
Per requirement, When bulk/uniform rejection of approval is there then I need to pop a window with a field call " Rejection Reason" then need to capture "Rejection Reason" to the Comments field of Approval and also set Approval State to Reject.
I know I need to create UI Page to pop up a window, but how I could capture the Rejection reason fields values to the approval Comments field?
Thank you.
Regards,
Virendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 02:30 AM
I have worked on similar requirement to populate onhold reason and copying the same to comments also. You can refer this and make modifications. Below code will give a pop up window and fields like onhold reason and comments.
function onClick(g_form) {
var holdReason = [{
type: 'choice',
name: 'hold_reason',
label: getMessage('On-hold reason'),
mandatory: true,
choices: [{
displayValue: 'Awaiting Caller',
value: '1'
},
{
displayValue: 'Awaiting Change',
value: '5'
},
{
displayValue: 'Awaiting Problem',
value: '3'
},
{
displayValue: 'Awaiting Vendor',
value: '4'
},
{
displayValue: 'Awaiting Approval',
value: '6'
}
]
}];
var holdComment1 = [{
type: 'textarea',
name: 'holdComment1',
label: getMessage('Additional Comments'),
mandatory: true
}];
g_modal.showFields({
title: "Please provide onhold reason",
fields: holdReason,
size: 'md',
}).then(function(selReason) {
if (selReason.updatedFields[0].value == '1') {
g_modal.showFields({
title: "Provide details on the onhold reason",
fields: holdComment1,
size: 'md'
}).then(function(newHoldComment) {
g_form.setValue('incident_state', 3);
g_form.setValue('state', 3);
g_form.setValue('hold_reason', selReason.updatedFields[0].value);
g_form.setValue('comments', newHoldComment.updatedFields[0].value);
if (g_form.getValue('hold_reason') == 1 && g_form.getValue('caller_id') == g_form.getValue('assigned_to')) {
g_form.addErrorMessage('The Caller and Assignee cannot be same person for the on hold reason "Awaiting Caller"');
g_form.setMandatory('hold_reason', false);
g_form.setValue('hold_reason', '');
g_form.setValue('incident_state', 2);
g_form.setValue('state', 2);
//g_form.addInfoMessage('inside if condition');
return false;
}
g_form.save();
});
} else {
g_form.setValue('incident_state', 3);
g_form.setValue('state', 3);
g_form.setValue('hold_reason', selReason.updatedFields[0].value);
g_form.setValue('comment',newHoldComment.updatedFields[0].value);
g_form.save();
//gs.addInfoMessage.getMessage('Incident ' + current.number + ' is "On-Hold".');
}
});
}
Regards,
Priyanka Jeganathan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 08:04 AM
Thanks for the input @PVJShareKnowled
Where did you write this coding part ? UI Action ?