- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 11:08 AM
Why that after Im changing incident's state to closed and save, the state's value field is being empty ?
When I do 'show xml' I do see that the state has a value but on the form its empty
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 11:59 AM
Please check if you are admin or member of HamalGroup then you can see the state value 7 ( Closed ) otherwise third [ else ] condition is removing state = 7.
You can comment the else part and test it again.
else {
// g_form.removeOption('state', '7'); //assuming 7 is closed state value
}
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 11:20 AM
Hi @Alon Grod ,
Check the label value of all state option, xml is showing the value of label. There may be some issue with Label.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 11:26 AM
@AshishKM i saw that when I disabled this client script im able to see the value, what am I doing wrong?
function onLoad() {
var ga = new GlideAjax('global.StateFlowAJAX');
ga.addParam('sysparm_name', 'getValidStates');
ga.addParam('sysparm_state', g_form.getValue('state'));
ga.addParam('sysparm_table', 'incident');
ga.addParam('sysparm_sys_class', 'sf_state_flow');
ga.getXML(clientScriptAjaxResponse);
}
function clientScriptAjaxResponse(serverResponse) {
//Clear the list and add only valid options
g_form.clearOptions('state');
var result = serverResponse.responseXML.getElementsByTagName('result');
if (result.length > 0) {
var value = result[0].getAttribute('values').split(',');
var label = result[0].getAttribute('labels').split(',');
for (var i = 0; i < value.length; i++) {
//Avoid adding the closed option form here
if (label[i] != "Closed") {
g_form.addOption('state', value[i], label[i]);
}
}
var mandatory = result[0].getAttribute('mandatory').split(',');
var readonly = result[0].getAttribute('readonly').split(',');
var visible = result[0].getAttribute('visible').split(',');
var notmandatory = result[0].getAttribute('notmandatory').split(',');
var notreadonly = result[0].getAttribute('notreadonly').split(',');
var notvisible = result[0].getAttribute('notvisible').split(',');
for (var i = 0; i < mandatory.length; i++)
if (mandatory[i])
g_form.setMandatory(mandatory[i], true);
for (var i = 0; i < notmandatory.length; i++)
if (notmandatory[i])
g_form.setMandatory(notmandatory[i], false);
for (var i = 0; i < readonly.length; i++)
if (readonly[i])
g_form.setReadOnly(readonly[i], true);
for (var i = 0; i < notreadonly.length; i++)
if (notreadonly[i])
g_form.setReadOnly(notreadonly[i], false);
for (var i = 0; i < visible.length; i++)
if (visible[i])
g_form.setDisplay(visible[i], true);
for (var i = 0; i < notvisible.length; i++)
if (notvisible[i])
g_form.setDisplay(notvisible[i], false);
}
if (g_form.getValue('state') == '6') { //Assuming 6 is resolved
var ga = new GlideAjax('AjaxUtil');
ga.addParam('sysparm_name', 'isUserMemberOfHamalGroup');
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
// alert(g_form.getValue("u_system_failure"));
if (answer == 'admin') {
g_form.addOption('state', '7', 'Closed');
} else if (answer == 'true' && g_form.getValue("u_system_failure") == 'true') {
g_form.addOption('state', '7', 'Closed'); //assuming 7 is closed state value
} else {
g_form.removeOption('state', '7'); //assuming 7 is closed state value
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 11:59 AM
Please check if you are admin or member of HamalGroup then you can see the state value 7 ( Closed ) otherwise third [ else ] condition is removing state = 7.
You can comment the else part and test it again.
else {
// g_form.removeOption('state', '7'); //assuming 7 is closed state value
}
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 12:42 PM
hope you got the root cause.
please accept the solution.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution