Problem with mandatory fields in mobile app.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 05:41 AM
I have created a Mobile UI Action that is supposed to make several fields mandatory if there are no value sat before resolving it in the mobile App. My issue is that the mandatory fields are ignored and the Incident is resolved. After the Incident is resolved the fields are marked as mandatory.
Below is the script I've been using.
var manda = false;
if (g_form.getValue('comments') == ''){
g.form.setMandatory('comments', true);
manda = true;
}
if (g_form.getValue('category') == ''){
g_form.setMandatory('category', true);
manda = true;
}
if (g_form.getValue('assigned_to') == '') {
g_form.setMandatory('assigned_to', true);
manda = true;
}
alert('All mandatory fields need to be filled');
return false; //Abort submission
//}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'resolve incident'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.state = 6;
current.incident_state = 6;
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:01 AM
sounds like you need an the UI action to set the state to 6 but not save the change then an onchange client script to set the fields as mandatory
BUT do run/process the update on the ui action/client script
I'd not show the Resovle ui action if the fields aren't already completed tbh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:18 AM
Mathias,
Why don't you use UI Policies for making those fields mandatory?
I worked on the same using UI Policies.
Thanks,
Vnay