Howto: Pseudo read-only custom fields

Just sharing. This is how I disabled editing of certain custom
fields via the web UI.

Part 1: Make the word READONLY appear in your custom field’s
description.

Part 2: Edit share/html/Tickets/Elements/EditCustomFields
(or whatever proper ‘local’ file :)) to look like this
for the “table row” block.

…stuff here…

% } <% loc($CustomField->Name) %>
Type: <% $CustomField->FriendlyType %> % if ($CustomField->Description =~ /READONLY/) { READ-ONLY FIELD % } else { % my $default = $m->notes('Field-' . $CustomField->Id); % $default ||= $ARGS{"CustomField-". $CustomField->Id }; <& /Elements/EditCustomField, %ARGS, Object => $TicketObj, CustomField => $CustomField, NamePrefix => $NamePrefix, Default => $default, &> % if (my $msg = $m->notes('InvalidField-' . $CustomField->Id)) {
<% $msg %> % } % }

% unless ( $i % 2 ) {

...stuff here...

Just sharing. This is how I disabled editing of certain custom
fields via the web UI.

Part 1: Make the word READONLY appear in your custom field’s
description.

Part 2: Edit share/html/Tickets/Elements/EditCustomFields
(or whatever proper ‘local’ file :)) to look like this
for the “table row” block.

Why just not grant the users in question the “Modify Custom Fields” right?

Just sharing. This is how I disabled editing of certain custom
fields via the web UI.

Part 1: Make the word READONLY appear in your custom field’s
description.

Part 2: Edit share/html/Tickets/Elements/EditCustomFields
(or whatever proper ‘local’ file :)) to look like this
for the “table row” block.

Why just not grant the users in question the “Modify Custom Fields” right?

Sadly, I knew about that, and had tested it to work just hours
before posting this. In those few hours I ended up in
share/html/Tickets/Elements/EditCustomFields to add the
display of $CustomField->Description information for the
viewer. I got sidetracked in that file and implemented
something I had already found a solution to.

More sadly, I posted it publicly :slight_smile: