Making fields Read-only at runtime based on some criteria

By | August 3, 2012

New record creation in Sage CRM is quite a straight forward work using the context based screens and the buttons that are available on several screens. The process can be as simple as mentioned below.
1) Log into Sage CRM
2) Right Click on the New button
3) Select Company option from list
4) Enter the Required details.
5) Click on the Save button
Now sometimes not all entries are to be made by the person who creates the record for e.g. Project sizing. One who creates the entries might not know the actual size of the project hence it should not be filled by him. Now how do we handle such special case scenario with Sage CRM screens so that only specific user can modify the specific value? Below are the steps you can follow. You can easily change the script to work with any criteria like profile, territory etc.
1) Log into Sage CRM
2) Go to Administration | Customization | <Entity Name> | Screen.
3) Click on the <Screen Name> hyperlink.
4) Select the <Field Name> from Field list.
5) Enter the below given code in Created script box.
var CurrentUserid=New String(eWare.GetContextInfo(“User”,”User_Userid”);
if(CurrentUserid==”” || CurrentUserid==”null” || CurrentUserid==”undefiend”) CurrentUserid=”0”;
6) Click on the Update and Save button.
If the security needs to be applied system wide it can be done using Field level security as explained below.
1) Log into Sage CRM.
2) Go to AdministrationCustomization | <Entity Name> | Fields.
3) Click on the Field security button of field.
4) Click on the New button.
5) Please refer the below given screenshot for the same.

6) Select User radio button.
7) Select the Users Name from Multi-select List.
8) Click on the Save button.
9) Uncheck the Write allow checkbox for selected users and save.