
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 12:53 AM
There is a requirement to make the "comments" mandatory if someone rejects the Change Ticket via the list context menu UI Action i.e. right click on the Approver related list. I managed to make some modifications in the script posted in the community by someone else with similar requirement but its not working as expected. Although, after clicking Reject, its redirecting to enter the mandatory comments but after entering the comments, state is not changing to "Rejected". Can anyone help on this ?
function rejectRequest()
{
if (g_form.getValue('comments') == '')
{
//Remove any existing field message, set comments mandatory, and show a new field message
try {g_form.hideFieldMsg('comments');} catch(e) {}
g_form.showFieldMsg('comments','Please provide comments for rejection.','error');
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(),'Reject'); //MUST call the 'Action name' set in this UI Action
}
if (typeof window == 'undefined')
serverReject();
function serverReject()
{
current.state='rejected';
current.update();
}
Note : function rejectRequest(); is in 'Onclick' field of the ui action form.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 02:19 AM
I use this as a ui action on the approval table with appropriate conditions
current.state = 'rejected';
if (!gs.nil(current.comments))
current.update();
else {
gs.addErrorMessage(gs.getMessage("Comments are required when rejecting an approval"));
current.state = 'requested';
current.setAbortAction(true);
action.setRedirectURL(current);
}
Bear in mind what you want your state to be if they don't add the comment.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 01:16 AM
can you share the UI action screenshot?
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 01:32 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 01:40 AM
Can you add "Reject" in Action name and try?
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2019 02:19 AM
Hi Harish, This did not solve the issue. Already tried putting this earlier, 🙂 Trying my luck with Scott's script now 🙂