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
rupesh ranjanrupesh ranjan 

i need to paas parameter(ContentCategoryId) on selection of pick list value urgent pls help

i need to paas parameter on selection of pick list
VF page  

<apex:pageblockSection >
    <apex:selectList size="1" value="{!productName}" id="ContentCategoryId">   
     <apex:selectOptions value="{!items}"/>   
  <apex:actionSupport event="onchange" action="{!getperformcallout}" rerender="normalList">
      <apex:param name="ContentCategoryId" assignto="{!ContentCategoryId}" value="{!ContentCategoryId}"/>
    </apex:actionSupport>   
     </apex:selectList>
     </apex:pageblockSection>
 </apex:pageBlock>
 <apex:pageblock >
Public  class videolistclass{
public String ContentCategoryId{get;set;}
PUBLIC List<selectOption> Items;
    public String toAddresses {get; set;}
     public   String MySessionID = UserInfo.getSessionID();
   
     public   String myurl= URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/c/10.0/' + UserInfo.getOrganizationId();    
     public   string c='eU9WzoFgU4n8Apu5PYxcNGRZswRDZJWDEMdbQVU85gw=';
     public   String Acode= Userinfo.getuserid();
     
     public   String Oid = '00D280000018TjaEAE';
    Blob cryptoKey= EncodingUtil.base64Decode(c);
    Blob data = Blob.valueOf(MySessionID );
    Blob data1 = Blob.valueOf(myurl);
  
    Blob data4 = Blob.valueOf(Acode);
    Blob data5 = Blob.valueOf(Oid);
 
    Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
    Blob encryptedData1 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data1);

    Blob encryptedData4 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data4 );
    Blob encryptedData5 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data5 );
  
    public    String b64Data = EncodingUtil.base64Encode(encryptedData);
    public    String b64Data1 = EncodingUtil.base64Encode(encryptedData1);
 
    public    String b64Data4 = EncodingUtil.base64Encode(encryptedData4);
    public    String b64Data5 = EncodingUtil.base64Encode(encryptedData5);
   
    public String aucode= EncodingUtil.urlEncode(b64Data4, 'UTF-8');
    public String ocode= EncodingUtil.urlEncode(b64Data5, 'UTF-8');
    
    public String ssnid{get;set;}
    public boolean normalList{get;set;}
    public boolean selectedList{get;set;}
    public String Title{get;set;} 
    public Boolean selected {get; set;}  
   public List<videolist> ConsoleWrapperList5{get;set;}
    public string productName{get;set;}
    
    public videolistclass() {
        getperformcallout5();
        normalList = true;
        selectedList = false;
    }
     
    public List<videolist> getperformcallout5(){ 
        ConsoleWrapperList5 = new List<videolist>(); 
        HttpRequest req = new HttpRequest();
         HttpResponse res = new HttpResponse();
          Http http = new Http();
          string url = 'https://www.demomail.net/sf/api/ContactCategoryList?AUCode='+aucode+'&SOrgID='+ocode+'&CategoryId='+ContentCategoryId;
            req.setEndpoint(url);
              System.debug('&&: '+ url );
            req.setMethod('GET');
             res = http.send(req);
              if(res.getstatusCode() == 200 && res.getbody() != null)
              {
               ConsoleWrapperList5=(List<videolist>)json.deserialize(res.getbody(),List<videolist>.class);
               }
                return consolewrapperlist5; 
                }
    
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        for(videolist crRec : ConsoleWrapperList5){
            options.add(new SelectOption(crRec.ContentCategoryId, crRec.CategoryName));
        
        }   
        return options;
    }
    public List<consolewrap> ConsoleWrapperList{get;set;}
    public List<consolewrap> getperformcallout(){
        ConsoleWrapperList = new List<consolewrap>();
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        string url = 'https://www.demomail.net/sf/api/SendVideoContact?AUCode='+aucode+'&SOrgID='+ocode+'&CategoryId='+ContentCategoryId+'&LanguageId='+0;
        req.setEndpoint(url);        
		req.setMethod('GET');
        res = http.send(req);
        if(res.getstatusCode() == 200 && res.getbody() != null){
            ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class); 
            System.debug('value: '+ ConsoleWrapperList );
        }
        return consolewrapperlist;
    }   
}



 
Mahesh DMahesh D
Hi Rupesh,

What is the issue here? If possible please paste the full VF Page.

Because sometimes, if you use immediate=true for the commend button, it may not set the param values.

Regards,
Mahesh
Deepak GulianDeepak Gulian
<apex:pageblockSection >
    <apex:selectList size="1" value="{!ContentCategoryId}" id="ContentCategoryId">   
     <apex:selectOptions value="{!items}"/>   
  <apex:actionSupport event="onchange" action="{!getperformcallout}" rerender="normalList">
    </apex:actionSupport>   
     </apex:selectList>
     </apex:pageblockSection>
 </apex:pageBlock>
 <apex:pageblock >
Do this Simply.
 
rupesh ranjanrupesh ranjan
<apex:page controller="videolistclass" readOnly="true">
<apex:form >
<apex:pageBlock >
 
    <apex:pageblockSection >
    <apex:selectList size="1" value="{!productName}" id="ContentCategoryId">
     
     <apex:selectOptions value="{!items}"/>   
  <apex:actionSupport event="onchange" action="{!getperformcallout}" rerender="normalList">
      <apex:param name="ContentCategoryId" assignto="{!ContentCategoryId}" value="{!ContentCategoryId}"/>
    </apex:actionSupport>   
     </apex:selectList>
     </apex:pageblockSection>
 </apex:pageBlock>
 <apex:pageblock > 
  
<c:PageBlockTableEnhancerADV targetPbTableIds="a"  pageSizeOptions="5,10,15,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200" defaultPageSize="50" enableExport="false"/> 
<apex:pageBlockTable id="a" value="{!performcallout}" var="wrap" width="100%"  rendered="{!normalList}">

<apex:column headerValue="Title" value="{!wrap.Title}"/>
<apex:column >
<apex:inputCheckbox value="{!wrap.selected}" > 
</apex:inputCheckbox>
</apex:column>
</apex:pageBlockTable> 
</apex:pageBlock>  
</apex:form>
</apex:page>
Public  class videolistclass{
public String ContentCategoryId{get;set;}
PUBLIC List<selectOption> Items;
    public String toAddresses {get; set;}
     public   String MySessionID = UserInfo.getSessionID();
   
     public   String myurl= URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/c/10.0/' + UserInfo.getOrganizationId();    
     public   string c='eU9WzoFgU4n8Apu5PYxcNGRZswRDZJWDEMdbQVU85gw=';
     public   String Acode= Userinfo.getuserid();
     
     public   String Oid = '00D280000018TjaEAE';
    Blob cryptoKey= EncodingUtil.base64Decode(c);
    Blob data = Blob.valueOf(MySessionID );
    Blob data1 = Blob.valueOf(myurl);
  
    Blob data4 = Blob.valueOf(Acode);
    Blob data5 = Blob.valueOf(Oid);
 
    Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
    Blob encryptedData1 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data1);

    Blob encryptedData4 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data4 );
    Blob encryptedData5 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data5 );
  
    public    String b64Data = EncodingUtil.base64Encode(encryptedData);
    public    String b64Data1 = EncodingUtil.base64Encode(encryptedData1);
 
    public    String b64Data4 = EncodingUtil.base64Encode(encryptedData4);
    public    String b64Data5 = EncodingUtil.base64Encode(encryptedData5);
   
    public String aucode= EncodingUtil.urlEncode(b64Data4, 'UTF-8');
    public String ocode= EncodingUtil.urlEncode(b64Data5, 'UTF-8');
    
      public String ssnid{get;set;}
    public boolean normalList{get;set;}
    public boolean selectedList{get;set;}
    public String Title{get;set;} 
    public Boolean selected {get; set;} 
  
  
   public List<videolist> ConsoleWrapperList5{get;set;}
    public string productName{get;set;}
    
    public videolistclass() {
        getperformcallout5();
        normalList = true;
        selectedList = false;
    }
     
    public List<videolist> getperformcallout5(){ 
        ConsoleWrapperList5 = new List<videolist>(); 
        HttpRequest req = new HttpRequest();
         HttpResponse res = new HttpResponse();
          Http http = new Http();
          string url = 'https://www.demomail.net/sf/api/ContactCategoryList?AUCode='+aucode+'&SOrgID='+ocode+'&CategoryId='+ContentCategoryId;
            req.setEndpoint(url);
              System.debug('&&: '+ url );
         //  req.setEndpoint('https://www.demomail.net/sf/api/ContactCategoryList?AUCode='+aucode+'&SOrgID='+ocode');
            req.setMethod('GET');
             res = http.send(req);
              if(res.getstatusCode() == 200 && res.getbody() != null)
              {
               ConsoleWrapperList5=(List<videolist>)json.deserialize(res.getbody(),List<videolist>.class);
               }
                return consolewrapperlist5; 
                }
    
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        for(videolist crRec : ConsoleWrapperList5){
            options.add(new SelectOption(crRec.ContentCategoryId, crRec.CategoryName));
            System.debug('##: '+ crRec.ContentCategoryId);
        }   
        return options;
    }
    public List<consolewrap> ConsoleWrapperList{get;set;}
    public List<consolewrap> getperformcallout(){
        ConsoleWrapperList = new List<consolewrap>();
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
      // req.setEndpoint('http://webapi.demomail.net/test/SendVideoContact.js?id='+SessionId); 
     string url = 'https://www.demomail.net/sf/api/SendVideoContact?AUCode='+aucode+'&SOrgID='+ocode+'&CategoryId='+ContentCategoryId+'&LanguageId='+0;
        System.debug('**: '+ url);
      req.setEndpoint(url);
      //req.setEndpoint('https://www.demomail.net/sf/api/SendVideoContact?AUCode=00530000000rLMxAAM&SOrgID=00Dn00000008gwlEAAs');
      // req.setEndpoint('https://www.demomail.net/sf/api/SendVideoContact?AuCode=4UFddF%2Btu%2FruNLEMGaWlEquOgTQ%2BCYD%2B8WbMf%2BvvCQXZktktdh715su7NbJyQcxU&SOrgID=Qtsb2h7ARH8gIlc5WhisMi%2BXOBnR0eQ7kqiV4%2B24NVlZv5njhdINbigmgGaLtcD1&CategoryId=0&LanguageId=0');
        //System.debug('!!!'+ SessionId);
        req.setMethod('GET');
      
         system.debug('???'+aucode);
           system.debug('***'+ocode);
        res = http.send(req);
       
       // System.assert(false,res.getBody()+'-----');
        if(res.getstatusCode() == 200 && res.getbody() != null){
            ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class); 
            System.debug('value: '+ ConsoleWrapperList );
        }
        return consolewrapperlist;
    }   
}
 This is my full code

Two API Url
one for picklist (ContentCategoryId and category)
second for display (Title ) in page block table on selection of picklist value

I mean need to paas ContentCategoryId in second api URL

 
Mahesh DMahesh D
Hi Rupesh,

What value you are assign it to "ContentCategoryId".

Please print the value in VF page:

{!ContentCategoryId} and see what value you are getting into VF page.

Regards,
Mahesh
Deepak GulianDeepak Gulian
<apex:selectList size="1" value="{!ContentCategoryId}" id="ContentCategoryId">
It seems you are not using productName any where in your class, so just update your VF page with my above code. So what will happen is, onchange event selected value of picklist is assigned directly to ContentCategoryId variable.
Mahesh DMahesh D
Hi Rupesh,

If you are expecting to get the selected value from the Select list then follow what deepak said.

<apex:selectList size="1" value="{!ContentCategoryId}" id="ContentCategoryId">

Change it like this and it will work, but if you are expecting something else then let us know.

Regards,
Mahesh
rupesh ranjanrupesh ranjan
Visualforce Error
Help for this Page
Return type of an Apex action method must be a PageReference. Found: core.apexpages.el.adapters.ApexListELAdapter
Deepak GulianDeepak Gulian
Through <apex:actionsupport you can call a method either a public void getperformcallout() or public PageReference getperformcallout()
Mahesh DMahesh D
The method which you are calling in the actionSupport should be a void return type.

public void getperformcallout() so that it will comeback to the same page and reRender some of the components.

Regards,
Mahesh