How to make custom relationship field required only for when user click on create view not record view using js file

Hi All,

We have made custom relationship field on accounts module non required as we don't want field to be required while converting lead on lead conversion page but we want field when create account using create button.
Can anyone suggest, how to make custom relationship field required only for when user click on create view not record view?
How to make field required using js?

Kindest Regards,
Shreya

Parents
  • Hi ,

    This solution should be achievable without the need for coding! When converting leads, any fields that exist between the lead record and the target record being created during conversion will have their values carried over from the lead. By leveraging that concept, you can use Sugar Logic to validate whether the account creation is coming from a lead conversion or some other means. Here are the steps I took to make a relationship field (or any other field) conditionally required on account creation but not lead conversion:

    1. Create a dropdown field in the Accounts module with a dropdown list of a blank value, 'Yes', and 'No'. Ensure the default value is set to the blank or 'No' option. In my example, I called the field 'lead_conversion':



      The field does not need to be added to the account record view layout. 
    2. Go to the relationship field in Studio and check the 'Required' box. Then fill in the following formula for the 'Required If' condition:
      not(equal($lead_conversion_c,"Yes"))




    3. Create a dropdown in the Leads module referencing the same dropdown list. Set the default value to 'Yes'. The field must be the same name as the dropdown field you created in step 1!



      As with the accounts module, this field does not need to be added to the record view layout. It will function behind the scenes.
    4. Mass update any existing leads to set the dropdown value to 'Yes' for your new field.
    5. Now, when converting a lead, the relationship field will not be required since the dropdown value is carried over to the account and the Sugar Logic formula does not validate:



      And when creating new accounts, the field will be required since that dropdown field passes the Sugar Logic formula validation:

    I hope this helps!

    Chris

Reply Children
No Data