Reference fields are disabled when using UI policies

Yuki21
Tera Expert

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>

find_real_file.png

find_real_file.png

<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>
find_real_file.png

1 ACCEPTED SOLUTION

Arav
Tera Guru
Tera Guru

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

View solution in original post

7 REPLIES 7

Sagar Pagar
Tera Patron

Hi,

As per my understanding, preview button might be disabled due to some other issue like UI action scripts.

Try to disable your UI policy and try to click on it.

 

Feel free to mark helpful & correct!

Thanks,
Sagar Pagar

The world works with ServiceNow

Thank you.
After disabling the UI policy, you can press the browse button.
Is there a way to make it possible to press the browse button while keeping the UI policy enabled?

Arav
Tera Guru
Tera Guru

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

Thank you.
I did the following based on the article, but there was no change in the situation.
Is it because I'm using UI action scripts?



setting property "glide.ui.reference.readonly.clickthrough" to true.


Add this in attributes field of the dictionary index, if want to make it clickable:
readonly_clickthrough=true