Siebel CRM Desktop for Microsoft Outlook Administration Guide > Customizing Siebel CRM Desktop > Customizing UI Behavior >
Making Forms Read-Only
You can configure Siebel CRM Desktop to make a form in the client read-only. The user can view values in a read-only form but cannot modify these values. To make forms read-only
- Open the form handler of the object that you must make read-only.
For more information, see Customizing Form Handlers.
- Add the following code to the form handler that you located in Step 1:
form_helpers.enable_form(ctx.form, editable);
where:
- ctx.form identifies the form that CRM Desktop must make read-only.
- editable is one of the following values:
- true. Makes the form readable and writable.
- false. Makes the form read-only.
For example:
form_helpers.enable_form(ctx.form, true);
- Add the following code to make the view readable:
ctx.form.view_name.enabled = true;
For example:
ctx.form.contacts_view.enabled = true;
If you make a form read-only in Step 2, then it is recommended that you enable the view that the form uses so that the user can scroll down through the form, can scroll to the side of the form, and can drill down on a record.
Making Top-Level Objects in Forms Read-Only
This topic describes how to make the top-level objects that reside in a form read-only. For example, you can use security logic to modify access in a script without displaying the form where this object resides, or you can disable this form even if the user possesses the permissions to modify an object where a script does the modifications. To make top-level objects in forms read-only
- Locate, and then modify the following code that resides in the form handler for the top-level object:
form_helpers.enable_form(ctx.form, modify_access);
where:
- modify_access contains one of the following values:
var modify_access = ctx.security_descriptor.modify_access();
Allowing Users to Add New Records in Read-Only Forms
This topic describes how to allow the user to add a new record in a read-only form. The example in this topic configures a form that allows the user to create new accounts but not to change existing accounts. If you use this configuration, then the user cannot use the scrollbar and cannot drill down on a record. To allow users to add new records in read-only forms
- Use a JavaScript editor to open the forms.js file.
- Add the following code to the account_form function:
ctx.form.enabled = (ctx.item_ex.get_id() == null);
This code allows the user to create a new account and to edit account information until the user saves the account. If the user saves the account, then the user cannot edit the account.
When CRM Desktop saves an item it sets an Id for that item. This code determines if CRM Desktop has set an Id for the current item. It returns one of the following values:
- True. An Id is not set for the item. This value indicates that the user can edit the form.
- False. An Id is set for the item. This value indicates that the user cannot edit the form.
- Add the following code to make the view readable:
ctx.form.view_name.enabled = true;
For example:
ctx.form.accounts_view.enabled = true;
accounts_view is a view control that displays accounts from the forms_xx.xml file. If you make a form read-only in Step 2, then it is recommended that you make the view that the form uses readable so that the user can scroll down through the form, can scroll to the side of the form, and can drill down on a record.
- (Optional) To allow the user to edit information for a new account that the user has saved but not synchronized, you can change the code that you added in Step 2 to the following:
form_helpers.enable_form(ctx.form, !ctx.security_descriptor.is_synced());
This code determines if CRM Desktop has synchronized the current object and then does the following:
- If the current object is not synchronized, then it allows the user to edit the object.
- If the current object is synchronized, then it does not allow the user to edit the object.
- Test your modifications, and then republish the customization package.
For more information, see Republishing Customization Packages.
|