How can I make inline_edit field dynamic?

Hi All,

Currently, I am working on functionality where I  need to add a new field in the accounts detail and edit page. I have added a new field on both pages. 

Now, this field should be editable only to system admin users and not to regular users. I have added custom code for editview against that field like below which is working.

master\custom\modules\Accounts\metadata\editviewdefs.php

'customCode'=>'{if $IS_ADMIN}@@FIELD@@{else}<input title="" id="client_nm" name="client_nm" type="text" value="{$fields.client_nm.value}" readonly disabled="1" size="30" maxlength="255" >{/if}'

But for detailview, I did not find any particular solution. I tried the following solution by placing it in the following file-

master\custom\Extension\modules\Accounts\Ext\Vardefs\sugarfield_client_nm.php

global $current_user;

$dictionary['Account']['fields']['client_nm']['inline_edit']= $current_user->is_admin;
$dictionary['Account']['fields']['client_nm']['labelValue']='Client Name';

But this is not working.

Please guide

Parents
  • Hello Rajesh, 

    The easiest way to have this implemented is to create a new Role. 

    In this role, you can set the desired field to Read Only and add all your users to it. 

    The Admin users will not be affected and can still read and write: 

    You can find more information on roles here

Reply
  • Hello Rajesh, 

    The easiest way to have this implemented is to create a new Role. 

    In this role, you can set the desired field to Read Only and add all your users to it. 

    The Admin users will not be affected and can still read and write: 

    You can find more information on roles here

Children