
- 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:54 AM
Check this..same requirement as yours
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 01:47 AM
Are you rejecting an approval or cancelling the change?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 02:12 AM
I am trying to achieve this when rejecting the approval which in turn would reject the change Ticket.
- 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 03:44 AM
Thanks for the script but is there any option to redirect the user to enter comments on Change Ticket after throwing an error message ? Also, i would only want this for the approvals associated with change request only and not with other task tables. any updated script which can help in this ?