- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 11:45 AM - edited 06-18-2024 03:42 AM
Hi,
1. When "Defer" button is clicked I want "Reason for Rejection(u_reason_for_rejection)" field mandatory to fill-in. Once that field in filled in, Approver will click on "Defer" again. and form is updated/Saved, state moves to "Closed Skipped"
Updated code,
function ReaFRejc()
{
if(g_form.getValue('u_reason_for_rejection') == '')
{
g_form.setMandatory('u_reason_for_rejection', true);
g_form.gs.addInfoMessage(gs.getMessage("Mention the 'reason for rejection' of the Idea"));
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'sysverb_defer'); //MUST call the 'Action name' set in this UI Action
}
if(typeof window == 'undefined')
serverReopen();
current.state = '7';
current.close_notes = "Deferred by Demand Manager.";
current.update();
if (action.get('isFormPage') == 'true')
action.setRedirectURL(current);
else
action.setRedirectURL('/'+current.getTableName()+'_list.do');
When I click on "Defer', 'Reason for Rejection' is mandatory to fill-in, I update the field and click on "Defer" again. State does not move to "Close skipped" stays in "submitted' state'.
2. 'Reason for Rejection' field should only be visible when "Defer' is clicked.
How can I achieve this help?
Thanks,
Vaishnavi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:31 PM
This article explains how to combine client-side and server-side code in a single UI action. In the client-side part, you can use the following code to make your field mandatory:
g_form.setMandatory('u_reason_for_rejection', true);
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 09:04 AM
Configure a UI policy to hide reason for rejection by default. Then call setDisplay() before setMandatory() in the code of your UI action like this:
g_form.setDisplay('u_reason_for_rejection', true);
g_form.setMandatory('u_reason_for_rejection', true);
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 09:09 AM - edited 06-18-2024 09:42 AM
Okay. It worked. 🙂 I have added the comment in the rejection email. Even that worked.
But it does not show the field again on the form? after rejection. Its always hidden.
How can I make the commented field visible?
THANK YOU SO MUCH FOR THE HELP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 01:03 PM
In your UI policy that hides the field, add a condition: State is not Closed Skipped (or whatever state you are using).
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 02:11 AM
Thank you so much for the continued help!!