There may be occasions when you need to display a field or make a field mandatory only when specified conditions on another field are met. In this FAQ we will give you a quick outline of the step you need to take, followed by a real world example.
Conditional Field Show/HideTo set up the condition for determining when a custom field will appear:
An ExampleIn this example you'll see how to add a custom field to allow you to enter a "Reason for lost" on the Leads module when the Lead Rating is set to "Lost". The Rating field on Leads is a standard drop-down field on the system: Setting up the RuleTo begin with we need to create the Rule which will trigger the new custom field. This is done by going to Settings, then under Studio click Custom Field Conditions. This will take you to a screen that looks like this: Click on New Type to build the Condition. Firstly select the module on which you want to use the condition. Once you have done this, the screen will refresh to update the field selector. Then enter a Type Name, which will appear when you create the custom field under the Condition drop-down. Next select the Field to match the condition against. Please note that the field names here will not necessarily correspond with the field labels, and that custom fields will display as their field ID e.g. cf_377. When you are happy with the rule you have set up, click Save. Be aware that you cannot edit a conditional rule, but will need to start from scratch if you wish to make any changes.
Mandatory Conditional FieldMandatory Custom Field Conditions allow you to set up conditions under which a custom field can be made mandatory. These conditions can then be applied to custom fields when they are created. For example, you may only want to record an "area of interest" if the contact or company type is "Customer". This differs from conditional custom fields which will show/hide extra fields depending on other values. This instead will make fields mandatory dependent on other values.
Important: For this to work, you need to have the setting to display conditional fields dynamically enabled. To switch this on:
To set up a new mandatory conditional field:
You then choose the module for this condition, give the condition a name so you can find it in the list, select a field for the condition to be based off and then enter the value that field should match for the condition to apply. In the example below, the condition is for any Contact with the mailing city set to London. This could be used to make a "district" or "sales region" field mandatory to split up the city into areas.
Adding the Condition to a Custom FieldYou can do this either when you first create your custom field OR add a condition to an existing custom field. Adding to a New Custom FieldYou can now add the custom field as you normally would do in OpenCRM (click here for an FAQ on creating custom fields). Go to Settings - Custom Field Settings and select the module where you want to add the custom field, so in our example Lead Custom Fields, and select New Custom Field. In the screenshot below, we have created a new picklist field, and use the Condition box at the bottom of the screen to specify that this is a conditional field. Hit Save to finish the set up. Adding to an Existing Custom FieldTo add a new condition to an existing custom field, simply to go Settings > Studio > Custom Fields and select which module you created the original custom field in. Then click the "edit" option next to the field in either the Condition (red) and Mandatory Condition (purple) column. Once you have selected your new condition from the dropdown menu, click save. Easy as that. Adding the Condition to a Standard System fieldThe above options are only applicable to custom fields, as you can access those via the Custom Fields settings pages. You can apply a Condition or a Mandatory Condition to a system field by going to Settings > Default Organisation Field Access > select the relevant module. From this screen, you can use the Edit option in the Condition and Mandatory Condition columns to add the Condition. Note that you will need to create the condition first before you can apply it. Trying out the conditional fieldWhen creating or editing a Lead, we can now see an additional "help" icon beside the Rating field. If we select the value of "Lost" in this field, this will trigger the conditional field we have created. If you change the value again, from "Lost" to any other value, then this conditional field will once again be hidden.
As you see in the above example, conditional fields can appear as soon as you populate the trigger field. This has to be enabled. Go to Settings->Additional Settings->Interface Settings and tick to enable the setting.
Multiple ConditionsAdditionally, you are able to have multiple conditions operating on the same field. To enter multiple conditions, simply type each conditional value followed by a comma. You do not need to use a space after each entry (i.e. "London, Leeds, Liverpool" will work the same as "London,Leeds,Liverpool") For example, if you needed to be able to identify the general area (i.e. North, South, etc.) of certain cities for delivery purposes, you could have a condition set to run whenever the Mailing City was set to one of these cities. Your custom field would then appear when any of these cities was entered. In this example, we have used the cities London, Leeds, and Liverpool to trigger the Which Area conditional field. If the Mailing City field is set to Leeds, the custom field Which Area will appear. The Which Area field will be visible when either London, Leeds or Liverpool is selected as the Mailing City, but will not appear when another value is entered: You may also be interested in:
|