Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sometimes you may might want to make the database child information fields read-only. There are two 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:

    Code Block
    titleMainScript.sil
    lfDisable("customfield_xxxxx");
    where

    where customfield_xxxxx

    is

     is the the

    id

    ID of your

    dbcf

    database child custom field. You can see the

    cf id

    custom field ID as a parameter in the URL when editing its configuration

    (eg  '


    For example,  .../secure/admin/EditCustomField!default.jspa?id=10701

    ')Then create

    .
     

  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 on an the issue page of ProjX  the ProjX project, the MainScript.sil is executed and the customfieldthe customfield_xxxxx will be read-only.You can find more about Live Fields here, including a configuration example similar to the one above.
    Or, as an alternative method

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.You should add

Add the following javascript code into the

...

database child custom field description from the

...

field configuration

...

.

Code Block
<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

...

.

Image RemovedImage Added

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