- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 12:49 AM
Hey all,
I now have a requirement to lock fields, make them mandatory and unlock depending on states and wondered what the best/quickest approach would be below is the flow and what locks/mandatorys are needed
When the phase is in definition nothing is mandatory. this is a draft phase and at this point the user can save, request 4 eyes check and delete the record. Once 4 eyes is requested all fields are locked down other than the one for the name of the 4 eyes checker and if its approved or not. Once approved fields are no longer locked and the majority of them become mandatory. I had thoght a simple UI policy would be fine but that makes fields mandatory as soon as the 4 eyes approves. They should only be mandatory once the change is saved as it will be someone else populating those fields. With the different locks,unlocks and mandatory s I wondered how others have done it. My initial thought was a hidden check box that ticks once 4 eyes is done I then base my UI policy on that tick box.
Any thoughts?
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 04:22 AM
function onLoad() {
var phase = g_form.getValue('phase');
if (phase == 'Waiting Technical Review') {
g_form.setMandatory('u_4eyes_checker', true);
g_form.setMandatory('u_4eyes_completed', true);
g_form.setReadonly('start_date', true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 01:23 AM
You could create an onLoad client script that checks the fields value.
That way it would be ok to edit until you save the form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 01:24 AM
you could then set your mandatory fields in the onLoad script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 04:05 AM
Hey Both,
thanks for the response. I have tried setting up a Client script for this as I will be adding a number of conditions and i believe being able to add multiple ifs and else would fit the bill. I have tried various scripts with no success. the latest version is below. I did have one script that set the fields to the relevant state but only when I clicked the button, once the page completed the buttons action (changing phase) the fields reverted back to the previous state.
function onLoad() {
var hide = true;
if (g_form.getControl('incident_state')) {
var incident_state = g_form.getValue('incident_state');
if (incident_state == '6' || incident_state == '7')
hide = false;
}
if (g_form.getControl('state')) {
var state = g_form.getValue('state');
if (state == '6' || state == '7')
hide = false;
}
if (hide) {
g_form.setDisplay('close_notes',false);
g_form.setDisplay('close_code',false);
} else {
g_form.setDisplay('close_notes',true);
g_form.setMandatory('close_notes',true);
g_form.setDisplay('close_code',true);
g_form.setMandatory('close_code',true);
}
}
Any thoughts on any obvious mistakes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 04:11 AM
Wrong script. current script is:
function onLoad() {
var hide = true;
if (g_form.getControl('phase')) {
var phase_state = g_form.getValue('phase');
if (phase_state =! 'Waiting Technical Review' )
hide = false;
}
if (g_form.getControl('phase')) {
var phase = g_form.getValue('phase');
if (state == 'Waiting Technical Review' )
hide = true;
}
if (hide) {
g_form.setMandatory('u_4eyes_checker', true);
g_form.setMandatory('u_4eyes_completed', true);
g_form.setReadonly('start_date',true);
}
}