Field dependancy : display a textfield dependant from a custom multi-enum

Hello there !

i'm building a new project under Sugar Pro 7.5.2 and i'm meeting some difficulties : 

What i have and what i would like :

I have created a muliple choices dropdown, and a textfield.
I would like to display the textfield only if the user choses a specific value of my multi-enum dropdown.

So normally i would do that through studio, with the dependancy formula.


What i tried and what failed :

But there is a problem : my multi choice dpdwn is not showing under the Fields column in the formula editor. And even if i try to add it manually in my formula, i have an error of "field unrecognized".

So, how can i display a field on a Multi select field dependancy ?

I did not find any tips or tricks in my Community search, i even found martin peet being unanswered :
Using a Multi select box as dependancey criteria

it's been one year !

Please, tell me if i'll have to do that by code, and how.

Have a nice day ! :)
Parents Reply Children
  • I am new to sugarCRM. Recently I have searched for the same solution and google drop me here. I tried the above solutions but they are working for only dropdown field. Since, sugar logic is not working for multiselect field dependency. Multiselect field dependency keeps values as Objects. SO, by converting it into array and iterating the array we can find whether the multiselect field contains our required value or not.

    I know this this is very late but this will be helpful for the future readers like me.

    //solutions_c is Multiselect field
    //revenue_c is Textfield
    
    initialize: function(options) {
        this.plugins = _.union(this.plugins || [], ['HistoricalSummary']);
        this._super('initialize', [options]);
    
        //declare onChange
        this.model.on("change:solutions_c", this.SolutionsOnChange, this);
    },
    
    SolutionsOnChange: function(){
        var solutionsField = this.model.get('solutions_c').toString();
        var flag = 0; //set flag as 0
        //exploid by (,)
        var solutionsArray = solutionsField.split(",");
        for(var i = 0; i < solutionsArray.length; i++ ){
            if(solutionsArray[i] == "Electronics"){
                flag = 1; //set flag as 1
            }
        }
        if(flag == 1){
            $('[data-name="revenue_c"]').css('visibility', 'visible');
        }
        else{
            $('[data-name="revenue_c"]').css('visibility', 'hidden'); 
        }
    },



    Thank you,