Skip to main content
Hello all of you experts out there,

 

I need help with my formula behind a custom button that redirects to different VF pages based on criteria and as last resort, if none of the criteria is met use the standard "add product" functionality.

 

My formula in the button is as follows and works perfectly, but I need to add the fallback scenario:

 

/apex/{!IF( $User.Language__c == "fr" && $User.Division == "France", "opportunityProductEntryFR", IF( $User.Language__c == "fr" && $User.Division <> "France", "opportunityProductEntryBE_FR", "opportunityProductEntry"))}?addTo={!Opportunity.Id}&retURL={!Opportunity.Id}&sfdc.override=1&id={!Opportunity.Id}

 

So, first I look if the users language is french and division is France go to VF-FR, otherwise language is french, but division is not France go to VF-BE_FR, otherwise go to VF_normal

 

I'd like to add one more if namely IF($User.Language__c == "nl" && $User.Division == "Belgium", "opportunityProductEntry", use the standard functionality to add products which would be /p/opp/SelectSearch? but the problem is that at the beginning there is /apex/ in front.

 

Who could adapt my formula so that the 3 if's redirect to /apex/ formula... and otherwise use the standard functionality which goes to /p/opp/SelectSearch??addTo={!Opportunity.Id}&retURL={!Opportunity.Id}&sfdc.override=1&id={!Opportunity.Id}

 

Thanks for you help in advance ;-)
8 réponses
  1. 31 mars 2014, 12:11
    Gotcha!

     

    This one:

     

    var loc;

    if(

    "{!$User.Language__c}" == "fr" &&

    "{!$User.Division}" == "France"

    ){

    loc = "/apex/opportunityProductEntryFR?";

    }

    else if(

    "{!$User.Language__c}" == "fr" &&

    "{!$User.Division}" <> "France"

    ){

    loc = "/apex/opportunityProductEntryBE_FR?";

    }

    else if(

    "{!$User.Language__c}" == "nl" &&

    "{!$User.Division}" == "Belgium"

    ){

    loc = "/apex/opportunityProductEntry?";

    }

    else{

    loc = "/p/opp/SelectSearch?";

    }

    loc +=

    "addTo={!Opportunity.Id}&" +

    "retURL={!Opportunity.Id}&" +

    "sfdc.override=1&" +

    "id={!Opportunity.Id}";

    window.top.location.href = loc;

0/9000