- 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-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 03:06 AM
Hi @Slava Savitsky ,
I have updated the code accordingly, but the state is in "Submitted" state only, it does not move to "Close skipped".
When I click on "defer" , 'Reason for rejection; is mandatory, I fill-in the details. When I click on defer again. The form updates the comments, state is not close skipped and redirects me to Idea list.
If you can help me what is wrong in my code please?
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');
Thanks,
Vaishnavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 03:39 AM
There must be a business rule that prevents the state change. Review the code of the applicable business rules or use the business rule debugger to find out which one it is.
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 04:04 AM
Hi,
the script worked. 🙂
It did not define the server side script. I added the function and called it, it worked.
Can you help me with the other part?
I want 'reason for rejection" field visible only when defer is clicked. How can I achieve that?