UI action auto save upon click
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 09:16 AM
I have a Ui action where i am changing the state of the field on click but its not saving until i click on save
I checked the Client check box
and onclick i have a function :............... workinprogress();
and in the script
function workinprogress()
{
g_form.setMandatory('u_feedback_related_to_its_service', true);
g_form.setMandatory('assigned_to', true);
g_form.setValue('state', '2');
}
current.update();
My issue is when i click on the work in progress ui action its changing the state but not saving until i click on save and also it should check the fields "assigned to and u_feedback_related_to_its_service" if they are empty then it should make them mandatory and should not change the state until values provided.
can some one help me with the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 09:57 AM
You need to move the current.update() line inside your function. So just move it up before the }. That should get the record to save as soon as you click the button.
Setting fields to mandatory may be better done using a data policy rather than a client script, just so that you can force users to enter those values no matter how they are updating the record. Client scripts only apply when opening the form for an individual record. Data policies are enforced even if you update through any script, editing in a list view, or even using SOAP or REST updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 10:06 AM
its not updating 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 10:00 AM
I think you need to include the 'current.update()' inside the function.
Also, if you want to check the values of the two fields first:
function workinprogress()
{
if (g_form.getValue('u_feedback_related_to_its_service') == '') {
g_form.setMandatory('u_feedback_related_to_its_service', true);
return false; //Abort
}
if (g_form.getValue('assigned_to') == '') {
g_form.setMandatory('assigned_to', true);
return false; //Abort
}
g_form.setValue('state', '2');
current.update();
}
Might need some tweaking, I did not test 🙂
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 10:05 AM
its checking the mandatory conditions but its not updating the record