function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LudivineLudivine 

Apex redirect controller and picklist value not rendering in the form

Hi dreamteam,
I have made a redirection page for a related object on the account page, also available on opportunity page.
The account name is populating fine in both objects, but not my other picklists Business_group and Business_unit, the values are not showing in the form. However I see these values in the url of this new page...

My Apex Controller :

public without sharing class FTSRedirectController{
@TestVisible

    public final Field_Technical_Service__c fts;
    
    public Opportunity opp              {get;set;}
    public Account acc                  {get;set;}
    public String currencyCode          {get;set;}
    public String accId                 {get;set;}    
    public String defaultBusinessGroup  {get;set;}
    public String defaultBusinessUnit   {get;set;}
 

 public FTSRedirectController(ApexPages.StandardController stdController){
    
     //get the current record
        this.fts=(Field_Technical_Service__c)stdController.getRecord();
        
        user u = [SELECT Business_Group__c, Business_Unit__c, User_Division__c, User_Subdivision__c 
                  FROM User 
                  WHERE Id = :UserInfo.getUserId()];       
           
           
         // If a new Fts is opened from an Oppty:
         if(fts.Action_Name__c != null) {  
         opp = [
                    SELECT Id,Business_Group__c,Business_Unit__c, Manufacturing_plant__c, Sector__c, Vertical__c, Sub_Vertical__c, Expected_Sales_Revenue__c, CurrencyIsoCode, Account.Name, Expected_Units_Annually__c, AccountId
                    FROM Opportunity
                    WHERE Id = :fts.Action_Name__c
            ];
            
            //set the values :
            accId = opp.Account.Name;            
            currencyCode = opp.CurrencyIsoCode;                                
            defaultBusinessGroup = opp.Business_Group__c;
            defaultBusinessUnit = opp.Business_Unit__c;                 
        }
        
        system.debug('oppty : defaultBusinessUnit :'+defaultBusinessUnit+'defaultBusinessgroup:'+defaultBusinessGroup);
        
        
        // If a new Fts form is opened from an account:
        if(fts.Account_Name__c != null) {
        
            acc = [
                    SELECT Id,Business_group__c, Business_unit__c, name
                    FROM Account
                    WHERE Id = :fts.Account_Name__c or Id = :accId
            ];
             //set the values :
            accId = acc.Name;
            defaultBusinessGroup = acc.Business_Group__c;
            defaultBusinessUnit = acc.Business_Unit__c;
        } 
}
  public PageReference redirect()
    {
      String str='';
      
      str='/a4l/e?retURL=%2F001%2Fo&cancelURL=%2F001%2Fo&nooverride=1&CF00Nw0000006nT2m=='+accId+'&CF00Nw0000006nT2s=='+defaultBusinessGroup+'&CF00Nw0000006nT2t=='+defaultBusinessUnit+'&CF00Nw0000006nT2m=='+opp.id ;
     
     PageReference r= new PageReference(str);
        r.setRedirect(true);

        return r;
      
    }
}
----------------------------------------------------------------------------------------------------------------------------------------------------
My url :
https://amcorltd--uat.cs83.my.salesforce.com/a4l/e?cancelURL=%2F001%2Fo&CF00Nw0000006nT2m=%3DAaren+Laboratories_Ontario%2C+CA&CF00Nw0000006nT2s=%3DAmcor+Flexibles+Americas&CF00Nw0000006nT2t=%3DHealthcare+N.A.&nooverride=1&retURL=%2F001%2Fo

Do you Know if there is something special for picklist fields values?
Thank you,
Regards,
Ludi