- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 07:09 PM
Hello.
Implemented a script to deactivate a screen field in case of certain status in UI policy.
I have a field in my script that I don't want to deactivate, but I'm using exception handling,
but the reference field button doesn't work.
What is the cause?
<UI policy>
<UI policy Script>
function onCondition() {
//必要に応じて条件を挿入
var notReadOnly = ["u_choice_3","u_shounin_user_id","u_shounin_pw","u_sekininsha_user_id","u_sekininsha_pw","request"];
var fields = g_form.getEditableFields(); //フォームの編集可能フィールを取得
for (var x = 0; x < fields.length; x++) {
if(notReadOnly.indexOf(fields[x]) == -1){
g_form.setMandatory(fields[x], false); //必須を無効にする
g_form.setReadOnly(fields[x], true); //読取り専用にする
}
}
g_form.setReadOnly("variables."+ req_category_1, true);
g_form.setReadOnly("variables."+ req_category_2, true);
g_form.setReadOnly("variables."+ req_category_3, true);
g_form.setReadOnly("variables."+ req_category_4, true);
g_form.setReadOnly("variables."+ req_category_5, true);
g_form.setReadOnly("variables."+ req_device_1, true);
g_form.setReadOnly("variables."+ req_device_2, true);
}
<problem screen>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 08:16 PM
Hi,
Please check the community article below.
https://community.servicenow.com/community?id=community_question&sys_id=d570c3e1db98dbc01dcaf3231f96192e
You can enable it by setting property "glide.ui.reference.readonly.clickthrough" to true.
Thanks,
Arav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 09:55 PM
It is under investigation, but after commenting out the following processing in the script, the reference button can now be pressed.
However, what I'm making ReadOnly below is a different field than the reference field.
The requirement to make the fields of variables. ReadOnly is necessary.
I don't know why it affects me...
g_form.setReadOnly("variables."+ req_category_1, true);
g_form.setReadOnly("variables."+ req_category_2, true);
g_form.setReadOnly("variables."+ req_category_3, true);
g_form.setReadOnly("variables."+ req_category_4, true);
g_form.setReadOnly("variables."+ req_category_5, true);
g_form.setReadOnly("variables."+ req_device_1, true);
g_form.setReadOnly("variables."+ req_device_2, true);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 10:27 PM
Hi,
What are "req_category_1", "req_category_2" etc. ? Are these catalog variable names ?
If so, then please change
g_form.setReadOnly("variables."+ req_category_1, true);
to
g_form.setReadOnly("variables.req_category_1", true);
and try.
Thanks,
Arav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:38 PM
Thank you very much for your advice.
I solved it with a client script.
Implemented in olLoad