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

Hi Eric,



As I mentioned you cannot make fields mandatory/readonly to the table which is not in your scope. I.e you'r in custom scope and try to modify the global fields.


However this operation will work if you create a custom table extended from task. Here this is working because custom table is in your own scope.



Please let me know if I am missing something or if you have additional questions.


Hi Pradeep,



We are kind of having same issue, could you please help us in resolving it.



Issue:


We have built a custom table(x_ct_request) in our scoped application, this table extends task table.We are using SM variable editor (Global scope) which picks all the variables from the record producers and displays them on (x_ct_request) table. Now we need to make the fields on this variable editor mandatory.


Approach:1:-



I have written an on display Business rule to get all the variable editor fields in g_scratchpad and then tried to make them read only using a client script.


but i am getting an error saying "ReadOnly true not set on field variables.check_status: cross-scope access denied.".


The table on which this business rule and client script are executing are in same application scope i.e. custom application scope.



Approach:2:-



I have written a simple client script statement " g_form.setVariablesReadOnly(true);" bu this doesnt work as well.


When i alert with g_form.getValue('variables.variable_name'); i get the correct value in alert but it doesn't set to readonly I get the same error ("ReadOnly true not set on field variables.check_status: cross-scope access denied.").



Please suggest me a correct approach   if i am going wrong.



Waiting for your reply.




Thanks and Regards,


Zabeeulla.


Hi



If you are still trying to achieve this, try the below:



g_form.getControl('field').readOnly = true;



Thanks


Shiva



Please hit Like, Helpful or Correct if this answer helps you!


Aparna Macharl1
Mega Contributor
Hi zabeeulla,
 
Did you find any workaround for this?
 
Thanks,
Aparna.