No, I again checked it for account_type field, but its still not working.
The code in view.edit.php file is:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class CasesViewEdit extends ViewEdit
{
public function display()
{ // add this if function display doesn't exist
global $current_user;
// check if current user is in specific role
$IS_AM = in_array("ASC / Franchisee", ACLRole::getUserRoleNames($current_user->id));
if($IS_AM && !empty($this->bean->id))
{
$this->ev->ss->assign('readOnly', 'readonly = "readonly"');
$this->ev->ss->assign('readOnlyDropDown', 'disabled= "true"');
}
else
{
$this->ev->ss->assign('readOnly', '');
$this->ev->ss->assign('readOnlyDropDown', '');
}
parent::display(); // add this if function display doesn't exist
} // add this if function display doesn't exist
}
And the code in editviewdefs.php is:
array (
'name' => 'ticket_status_c',
'studio' => 'visible',
'label' => 'LBL_TICKET_STATUS',
'customCode' => '
Open
Closed
Pending
',
),
),
This is for custom dropdown and it is working fine, now I have removed the default dropdown. You can use any default dropdown field from the module.
Thanks,
Sandeep Bodh
I dont understand why it would work for custom fields and not for default fields yet fairly surprised that it works at all.
By definition, a dropdown is always READONLY.
By definition, a dropdown DISABLED is not sent via FORM SUBMIT.
So if you were to set the field to disabled it would act like its read only and not selectable. however doing this will remove it from being posted to SuiteCRM and not saved into the database. I overcame this by setting the dropdown to disabled and inserting a hidden field with the same name and value of the disabled field. e.g
<select name="one" disabled>
<option selected>default
<option>other
<option>you can't pick this
<option>pick me if you can
<option>blah
</select>
<input type="hidden" name="one" value="default">
all thats left to do here is put this into SuiteCRM for the drop downs that you require it on. Hope that helps.