Policy Automation for B2C Service

Get Involved. Join the Conversation.


    Karthik Jayachandran
    How to set value for a field even when the field is read...
    Topic posted December 14, 2017 by Karthik JayachandranRed Ribbon: 250+ Points 
    176 Views, 7 Comments
    How to set value for a field even when the field is read only ?


    Based on the “Rental unit” field value, we have to set value for the field “Kpp Ext coverage” and then we have to make “Kpp Ext coverage” field read only.


    First it is making the “Kpp Ext coverage” field read only and then trying to set value. Since the field is already read only, the value is not getting set.

    Oracle policy automation(Aug 16)



    • Luuk

      I don't think it's possible to set a value to a read only field.

    • Gursimran Singh Saini

      Try doing it with Javascript. Store JS file with following code in resources folder.

      I have worked in OPA a few times only so this code might not work properly. But it will help you get started.

          customInput: function(control,interview) {
              var kpp_ext_coverage = "kpp_ext_coverage_input";
              // The Right hand side string has to be actual Input ID of this field. You can get it by checking View Source.
              // Alternatively you can alert(control.id) until you see ID of kpp_ext_coverage field 
              if(control.id == kpp_ext_coverage){

    • Karthik Jayachandran

      Hi Gursimran Singh saini ,

      Tried Setting the value for Control using the JS code but it is not getting updated as the control is Read only.

      Can we know does we have any Libraries of JS function that we can use in the OPA.

      Tried the below code to set the value to the control,


          customInput: function(control,interview) {

              if(control.id == "global_global_a_first"){






      Note: We have to set the value to the field in Runtime ,but the above code is getting fired when the interview is getting loaded, So do we have any function to capture the Value change of the control?

      it will be more helpful for us if you refer some documentation of JS function that can be used in the OPA.

    • Jasmine Lee

      Is an end user ever manually setting the value of 'KPP Ext Coverage' in the interview? Or is it always set based on the value of 'Rental Unit'?

      If the value is always set based on a rule, then I wouldn't even add it as an input on the interview screen. I'd just display the value using substitution in a label, which means you don't need to worry about read-only. Also, substitution is out-of-the-box functionality, so you wouldn't need any code.

      Show attribute values in other screen text: 

    • Jasmine Lee

      If you upgrade to a later version (preferably the current version: OPA 17D), you can also take advantage of dynamic display of inferred values. This enhancement was added in OPA Nov 2016, so you won't see it in OPA Aug 2016.

      See the section 'Show me an example of the dynamic display of a calculated value' in this article: 

    • Karthik Jayachandran

      Hi Jasmine,


      thanks for the advice.

      we have upgraded to  OPA 17D but the complexity in both OPA 16/17D is , since the 'KPP Ext Coverage'  field get read only first , its not allowing to set the value Y/N.

      So how to set the value (Y/N) first ,then make the field as read only ?



    • Jasmine Lee

      Is KPP Ext Coverage always inferred? (i.e. the value is always determined based on the value of Rental Unit)? Your posts are ambiguous on this point, so I'm just going to assume it's always an inferred value unless you indicate otherwise.

      If KPP Ext Coverage is always inferred, then why not just display its value using substitution in a label? That way the end user can see the value of KPP Ext Coverage (which gets set based on the value of Rental Unit), but they can't edit it.

      Read-only just means it can't be edited, so showing the value in a label with substitution is effectively the same thing.