• aegirth
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
Hi

I have a controller that exposes a custom class, and a VF page that accepts input from the user, saves those values in a controller variable and uses them to call an external webservice, retrieve a list of responses in JSON format and parses them to class objects, and uses a data table to display them on the page.  So far, so good. The parse code works, but the part where I set values in the controller from user input fails.  When I say fails, it means the values are always empty and return null.  

The controller values are 
public String mobileNumber {get;set;}
public String month {get;set;}

I have tried quite a few things, moved the constructor around, tried an empty contructor, tried to set immediate=false on the command button, moved the button to it's own actionRegion.  To it's own <apex:form>.  All to no avail.

VF Page:

<apex:page showHeader="false" sidebar="false" controller="VF_WS_SMSNotification">
	<apex:sectionHeader title="SMS List" subtitle="List" />
	<apex:pageBlock>
	<apex:form>
	Phonenumber  <apex:inputText id="phoneno" value="{!mobileNumber}" label="number"/>
	Months: <apex:selectList size="1" id="months" value="{!month}">
	  	<apex:selectOption itemValue="1" itemDescription="1"/>
	  	<apex:selectOption itemValue="2" itemDescription="2"/>
	  	<apex:selectOption itemValue="3" itemDescription="3"/>
	  	<apex:selectOption itemValue="4" itemDescription="4"/>
	  	<apex:selectOption itemValue="5" itemDescription="5"/>
	  	<apex:selectOption itemValue="6" itemDescription="6"/>	
	  	</apex:selectList>
	  	</apex:form>
	  	</apex:pageBlock>
	  <apex:pageBlock>
	  <!--apex:outputPanel-->
	  <apex:form>
	  <apex:commandButton immediate="false" value="Press this" id="theButton" action="{!getList}" />
	  </apex:form>
	  
             <!--/apex:outputPanel-->                    
	</apex:pageBlock>

	<apex:pageBlock id="table" title="Notifications">
	
	<apex:dataTable value="{!smsList}" var="i" id="theTable" rowClasses="odd,even"

                       /* data table markup omitted  */
	</apex:dataTable>
	</apex:pageBlock>
</apex:page>

Controller code:

public with sharing class VF_WS_SMSNotification {

    //getters / setters 
     VF_WS_SMSNotification wnot {get;set;}
     public String mobileNumber {get;set;}   // this var is never set
     public String month {get;set;}               // this var is never set
     public List<SMS> smsList {get;set;}
     public String descr {get; set;}

     public VF_WS_SMSNotification()
      {
      mobileNumber='';
      month='';
      smsList=new List<SMS>();
      } 

 
      public class Output {
          public String xmlns_ns0 {get;set;}
          public List<SMS> SMS {get;set;}
     }
     
     public Output output;
 
     public class SMS {
          public String Text{get;set;}
          public String Status {get;set;}
          public String Type {get;set;}
          public String CreationDate {get;set;}
     } 

      //public SMS sms(){}

     

     
     /*  Parse function to generate instances of the output class, which contains 1 or more instances of the inner SMS class  */

     public static VF_WS_SMSNotification parse(String json) {
               String json2 = json.replace('ns0:', '');
               system.debug(json2);
               return (VF_WS_SMSNotification)System.JSON.deserialize(json2, VF_WS_SMSNotification.class);
     }       
     
    

    

      public List<VF_WS_SMSNotification.SMS> getSmslist(String phoneno, String months){

        phoneno =mobileNumber;
        months = month;
        system.debug('numer is:'+mobileNumber);
        system.debug('month is: '+month);
 
   
  /* Callout code omitted , not relevant  */
     
     String jsonResponse = res.getBody();
 
     

 
    
 
   VF_WS_SMSNotification wnot = new VF_WS_SMSNotification();
   wnot = parse(jsonResponse);

         List<VF_WS_SMSNotification.SMS> ist = new List<VF_WS_SMSNotification.SMS>();
       
           system.debug('________________Parsing SMS List: ');
        
           for(VF_WS_SMSNotification.SMS o: wnot.output.SMS){
              ist.add(o);
              system.debug('Text is: '+o.Text);
              system.debug('Status is: '+o.Status);
              system.debug('Type is: '+o.Type);
              system.debug('Creation date is: '+o.CreationDate); 
              system.debug('______________________________List size is NOW: '+ist.size());
           
         }

         for(integer i = 0;i<ist.size();i++){

            system.debug('Here is the data: Text is:'+ist[i].Text+' and status is '+ist[i].Status+' and Type is '+ist[i].Type+' and date is '+ist[i].CreationDate);
         }
 
 
     return ist;
 
      }   


      public PageReference getList(){


        system.debug('INSIDE VF BUTTON CALL___ :numer is:'+mobileNumber);
        system.debug('INSIDE VF BUTTON CALL___ :month is: '+month);
        smsList = getSmslist(mobileNumber,month);
        return null;

        

      }
}
Is there some fundamental n00b mistake going on here or am I misunderstanding how controller variables get set from a VF page?
  • September 29, 2014
  • Like
  • 0

As per the subject.  Is it possible to do this via some configuration file, and if not, where do I go about submitting a feature request doing just this?  It would be of great benefit if you could customize the layout, and even have it on a per profile basis.

 

 

This does no use any of the standard layouts, not the mini layout nor any else I find.

Hello

 

Is it possible for me to use a query like Date()-7 for a certain date/time field so the query returns values for the last 7 days?

 

Something like : 

 

select Id, OwnerId, dtDateDelivered__c from Service__c where dtDateDelivered__c < "TODAY()-7" ORDER BY dtDateDelivered__c LIMIT 10

 

Which doesn't work :)

 

 

Anyone here that has a Brainengine licence and has tried to install it in a VM, like VMware Fusion or Parallels?  If so, did it run OK?  

 

I'm mulling trying this out in a VM first, since I don't want to context-switch a lot by booting to Boot Camp whenever I use that IDE.   They do have a HTML based development-as-as-service something-something called Brainengine Next, but that's in beta right now.

 

 

When I'm on step 4, this comes up:

 

 

it defaults to your user, instead of the logged is user, Simon :)

Hi

I have a controller that exposes a custom class, and a VF page that accepts input from the user, saves those values in a controller variable and uses them to call an external webservice, retrieve a list of responses in JSON format and parses them to class objects, and uses a data table to display them on the page.  So far, so good. The parse code works, but the part where I set values in the controller from user input fails.  When I say fails, it means the values are always empty and return null.  

The controller values are 
public String mobileNumber {get;set;}
public String month {get;set;}

I have tried quite a few things, moved the constructor around, tried an empty contructor, tried to set immediate=false on the command button, moved the button to it's own actionRegion.  To it's own <apex:form>.  All to no avail.

VF Page:

<apex:page showHeader="false" sidebar="false" controller="VF_WS_SMSNotification">
	<apex:sectionHeader title="SMS List" subtitle="List" />
	<apex:pageBlock>
	<apex:form>
	Phonenumber  <apex:inputText id="phoneno" value="{!mobileNumber}" label="number"/>
	Months: <apex:selectList size="1" id="months" value="{!month}">
	  	<apex:selectOption itemValue="1" itemDescription="1"/>
	  	<apex:selectOption itemValue="2" itemDescription="2"/>
	  	<apex:selectOption itemValue="3" itemDescription="3"/>
	  	<apex:selectOption itemValue="4" itemDescription="4"/>
	  	<apex:selectOption itemValue="5" itemDescription="5"/>
	  	<apex:selectOption itemValue="6" itemDescription="6"/>	
	  	</apex:selectList>
	  	</apex:form>
	  	</apex:pageBlock>
	  <apex:pageBlock>
	  <!--apex:outputPanel-->
	  <apex:form>
	  <apex:commandButton immediate="false" value="Press this" id="theButton" action="{!getList}" />
	  </apex:form>
	  
             <!--/apex:outputPanel-->                    
	</apex:pageBlock>

	<apex:pageBlock id="table" title="Notifications">
	
	<apex:dataTable value="{!smsList}" var="i" id="theTable" rowClasses="odd,even"

                       /* data table markup omitted  */
	</apex:dataTable>
	</apex:pageBlock>
</apex:page>

Controller code:

public with sharing class VF_WS_SMSNotification {

    //getters / setters 
     VF_WS_SMSNotification wnot {get;set;}
     public String mobileNumber {get;set;}   // this var is never set
     public String month {get;set;}               // this var is never set
     public List<SMS> smsList {get;set;}
     public String descr {get; set;}

     public VF_WS_SMSNotification()
      {
      mobileNumber='';
      month='';
      smsList=new List<SMS>();
      } 

 
      public class Output {
          public String xmlns_ns0 {get;set;}
          public List<SMS> SMS {get;set;}
     }
     
     public Output output;
 
     public class SMS {
          public String Text{get;set;}
          public String Status {get;set;}
          public String Type {get;set;}
          public String CreationDate {get;set;}
     } 

      //public SMS sms(){}

     

     
     /*  Parse function to generate instances of the output class, which contains 1 or more instances of the inner SMS class  */

     public static VF_WS_SMSNotification parse(String json) {
               String json2 = json.replace('ns0:', '');
               system.debug(json2);
               return (VF_WS_SMSNotification)System.JSON.deserialize(json2, VF_WS_SMSNotification.class);
     }       
     
    

    

      public List<VF_WS_SMSNotification.SMS> getSmslist(String phoneno, String months){

        phoneno =mobileNumber;
        months = month;
        system.debug('numer is:'+mobileNumber);
        system.debug('month is: '+month);
 
   
  /* Callout code omitted , not relevant  */
     
     String jsonResponse = res.getBody();
 
     

 
    
 
   VF_WS_SMSNotification wnot = new VF_WS_SMSNotification();
   wnot = parse(jsonResponse);

         List<VF_WS_SMSNotification.SMS> ist = new List<VF_WS_SMSNotification.SMS>();
       
           system.debug('________________Parsing SMS List: ');
        
           for(VF_WS_SMSNotification.SMS o: wnot.output.SMS){
              ist.add(o);
              system.debug('Text is: '+o.Text);
              system.debug('Status is: '+o.Status);
              system.debug('Type is: '+o.Type);
              system.debug('Creation date is: '+o.CreationDate); 
              system.debug('______________________________List size is NOW: '+ist.size());
           
         }

         for(integer i = 0;i<ist.size();i++){

            system.debug('Here is the data: Text is:'+ist[i].Text+' and status is '+ist[i].Status+' and Type is '+ist[i].Type+' and date is '+ist[i].CreationDate);
         }
 
 
     return ist;
 
      }   


      public PageReference getList(){


        system.debug('INSIDE VF BUTTON CALL___ :numer is:'+mobileNumber);
        system.debug('INSIDE VF BUTTON CALL___ :month is: '+month);
        smsList = getSmslist(mobileNumber,month);
        return null;

        

      }
}
Is there some fundamental n00b mistake going on here or am I misunderstanding how controller variables get set from a VF page?
  • September 29, 2014
  • Like
  • 0

I have an external application that needs to write to and retreive data from an encrypted text field in salesforce. Currently, it appears that i'm able to do both these things without doing anything special (like decrypting the values), that doesn't seem correct to me. Is this right? Is there something unique I need to do when working with encrypted fields via the API?


Thanks.

Hello

 

Is it possible for me to use a query like Date()-7 for a certain date/time field so the query returns values for the last 7 days?

 

Something like : 

 

select Id, OwnerId, dtDateDelivered__c from Service__c where dtDateDelivered__c < "TODAY()-7" ORDER BY dtDateDelivered__c LIMIT 10

 

Which doesn't work :)

 

 

While Lexiloader almost replaces the need to boot up Windows for each DataLoader session, I haven't found a decent CSV editor for Mac.

Microsoft Excel is just such a bloated piece of junk on the Mac and almost all smaller tools (that I know of) fail to deliver.

 

What's your tool of choice to prepare data for Lexiloader?

 

(for now I stick with Parallels / WinXP / Excel2003 and/or Access 2003)

 

- Andreas