The CreatorCon Call for Content is officially open! Get started here.

Problem with mandatory fields in mobile app.

Mathias Nilsson
Tera Contributor

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.  

function resolveIncident(){

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();

}

2 REPLIES 2

dave_edgar
Mega Guru

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


Inactive User24
Mega Expert

Mathias,



Why don't you use UI Policies for making those fields mandatory?


I worked on the same using UI Policies.



Thanks,


Vnay