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

Making variables read only on scoped application

ericeger
Tera Guru

Hello all,

In our application, we are using variables that are extended from the question_answer table in our Incident form. What I am trying to do is hide the variable based on the status of our Incident. I have an onLoad client script that runs and calls the variable name (e.g. g_form.setDisplay('variables.confirm_support_udf_quest, false)), but it is not responding. I have also tried, g_form.setReadOnly() for the variables, and that has not worked either. I can verify that using g_form.setValue and g_form.getValue works though.   Has anyone been able to have it so that variables in a scoped application are set to read-only within a scoped application? Any help would be appreciated, thanks!

Eric

8 REPLIES 8

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Eric,



Scoped applications cannot change the Mandatory, ReadOnly,   Display, or Disabled status of fields outside of their scope- with one interesting exception. If your Client Script runs on a table in your own application, and that table extends a table from another scope, the fields you inherit from that base table are considered in-scope when they are displayed on your form.


Creation Restrictions Across Application Scopes - ServiceNow Wiki


Hi Pradeep,



Thanks for getting back to me.   Are there any future plans to possible allow this though? I understand not wanting to control other fields that are not part of your table, but I thought maybe it would be a special case for variables since they are a little more customizable and can be seen on many tables.



Eric


Hi Eric,



Thanks for the update. I would request you to create Enhancement request on HI with your use case.


Enhancement requests: Tell us how you would improve the ServiceNow product



Please mark this post and close the thread if your question is answered


Hi Pradeep,



I did have a follow-up question that you could possibly answer.   I had mentioned before that with the variables I'm putting into my scoped application table that I can use g_form.setValue/g_form.getValue(), but I'm not able to make them mandatory/read-only/disabled.   Why is it that I can use some functionality with the variables, but not the others? Not sure why there would be a difference. Let me know when you can, thanks again!



Eric