Multiselect dependency in Enterprise 9.1 on SugarCloud. 

I created a multiselect field with dropdown and it works fine even for imports.  I create another field and check Dependent box.  When I edit formula the multiselect field does not appear in the list of values.  Is this not possible?

Thanks in advance

JimC

Parents
  • Hi Jim Cotten,

    Correct. The user interface does not let admins use multiselect fields in a calculation of another field or its dependency calculation (the two use the same interface essentially).

    There is a workaround you can employ at a code level that is fairly simple.

    Hosted by Sugar Cloud, you can use Module Loader to install a custom package with the custom code you wish to install. This requires knowing how to make a Module Loadable Package.

    Steps I took:

    1. In Studio, for Accounts, I created a multiselect field (ms1_c) and a textfield (tf1_c).
    2. I calculated tf1_c with this field variable formula: $name
    3. I added the two fields to the Accounts RecordView layout.
    4. In the file system, I edited custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_tf1_c.php
    5. I changed the formula from: 
      $dictionary['Account']['fields']['tf1_c']['formula']='$name';
      to: 
      $dictionary['Account']['fields']['tf1_c']['formula']='$ms1_c';
    6. I ran a Quick Repair and Rebuild to push these changes to throughout the appropriate files in the system.
    7. I edit an Account and set the multiselect with two sample values and save.

     

    The results appear in the RecordView

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  
    Note that at the database level, the values in a multiselect field are saved with the carrots around them, so those carrots are returned in by the calculated formula.

     

    I hope this helps!

Reply
  • Hi Jim Cotten,

    Correct. The user interface does not let admins use multiselect fields in a calculation of another field or its dependency calculation (the two use the same interface essentially).

    There is a workaround you can employ at a code level that is fairly simple.

    Hosted by Sugar Cloud, you can use Module Loader to install a custom package with the custom code you wish to install. This requires knowing how to make a Module Loadable Package.

    Steps I took:

    1. In Studio, for Accounts, I created a multiselect field (ms1_c) and a textfield (tf1_c).
    2. I calculated tf1_c with this field variable formula: $name
    3. I added the two fields to the Accounts RecordView layout.
    4. In the file system, I edited custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_tf1_c.php
    5. I changed the formula from: 
      $dictionary['Account']['fields']['tf1_c']['formula']='$name';
      to: 
      $dictionary['Account']['fields']['tf1_c']['formula']='$ms1_c';
    6. I ran a Quick Repair and Rebuild to push these changes to throughout the appropriate files in the system.
    7. I edit an Account and set the multiselect with two sample values and save.

     

    The results appear in the RecordView

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  
    Note that at the database level, the values in a multiselect field are saved with the carrots around them, so those carrots are returned in by the calculated formula.

     

    I hope this helps!

Children