Making Child Fields Read-Only (Legacy)

Sometimes you might want to make the database child information fields read-only. There are the following ways for doing this.

The first and simple way of doing it, and portable across Jira versions, is by using the lfDisable routine from the Live Fields feature of our Power Scripts™ for Jira app.

Option 1

  1. Create a SIL file called "Main Script" with the following code:

    MainScript.sil

    lfDisable("customfield_xxxxx");

    where customfield_xxxxx is the the ID of your database child custom field. You can see the custom field ID as a parameter in the URL when editing its configuration. 
    For example,  .../secure/admin/EditCustomField!default.jspa?id=10701.
     

  2. Create a Live Field Configuration using the above Main Script and associate it to a project, let's call it ProjX.

  3. Every time we enter the issue page of the ProjX project, the MainScript.sil is executed and the customfield_xxxxx will be read-only.

Option 2

As an alternative option you can use javascript injection into the custom field description. Note that this might not be portable across Jira versions.

Add the following javascript code into the database child custom field description from the field configuration.

<script type="text/javascript"> AJS.$('#customfield_10014').attr('readOnly', true); //the following code is for inline edit only JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) { if(reason == JIRA.CONTENT_ADDED_REASON.inlineEditStarted) { AJS.$('#customfield_10014', context).attr('readOnly', true); } }); </script>

where customfield_xxxxx is the the ID of your database child custom field. You can see the custom field ID as parameter in the URL when editing its configuration.
For example: .../secure/admin/EditCustomField!default.jspa?id=10701.

That's it. Your database child field will now be read-only on all screens.

See More