• Kevin Jackson 11
  • NEWBIE
  • 60 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 21
    Replies
Hi Have scanned the resources and cannot find a solution that works:

I know it has to be done along these lines here:

public static void getCountries()
    {
        Schema.DescribeFieldResult fieldResult = Contact.MailingCountryCode.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for(Schema.PicklistEntry s:ple){
            
            System.debug('value: '+s.getLabel());
        } 
    }

BUT I get this error :  "Method does not exist or incorrect signature: void getDescribe() from the type String"


With VF Page including:

<apex:selectList value="{!Country}" size="1" required="true">
                    <apex:selectOptions value="{!Countriesj}"/>
                      </apex:selectList>

I have tried other code, like the one from @gregorz Skaruz 
 http://skaruz.com/en/2015/03/english-salesforce-how-to-access-state-and-country-picklists-values-in-apex/

It looks great, but is is coming up with an empty Select options List.

Any Help is appreciated.
I am having a challenge passing a value selected/entered on a visual force page to the apex controller.  This should just work, but for some reason it is not working.  The value in the controller always reverts to the original value. Can you find the error in my code?
 
<apex:page standardStylesheets="false" controller="testApplyController" showHeader="false" action="{!contactx}">
    
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"></link>
    <meta charset="utf-8" />
    <apex:stylesheet value="{!URLFOR($Resource.customCSS)}"/>

    <title></title>

</head>
<body>
    <div class="ctr">
        <h2 class="title">
           Let's get started.
        </h2>
    </div>
    <br />
    <div class="centerform" >
        <form action="/" method="post"><apex:form >
            <table class="table-main">
                
                <tr>
                    <td style="min-width:270px; padding-right: 1em;">

                        Enter your email address   <br />
                         <apex:inputfield value="{!Contactx.email}" label="email" html-class="form-control" />
                       
                    </td>
                    <td style="min-width:270px; padding-right: 1em;">
                        What is your area of activity? <i class="fa fa-info-circle"  style="color:dimgrey" data-toggle="modal" data-target="#Roles"></i>     <br />
                        <apex:inputfield value="{!Contactx.Area_of_Activity_Signup__c}" label="activity" html-class="form-control"/>
                   		
                    </td>
                    <td style="min-width:270px; padding-right: 1em;">
                        Where do you live? <br />
                      <apex:inputfield value="{!Contactx.MailingCountryCode}" label="Country" html-class="form-control"/> 
                       
                    </td>
                </tr>
                 
            </table>

        </apex:form>  </form>
        <br />
    </div>

    <div class="ctr">
        <Apex:form > <Apex:commandButton styleclass="button back" style="color:teal; margin-right:10px;" action="{!UpdateContact}" value="back"   /> 
                    &nbsp;&nbsp;&nbsp;
        <Apex:commandButton styleclass="button" style="color:white;" action="{!UpdateContact}" value="Update"  /> </Apex:form>
     <!--   <button class="button back" style="color:teal; margin-right:10px;">back</button>

        <button class="button" style="color:white">next</button>
          --> 
    </div>
    <br /><br />
</body>
</html>
</apex:page>
Controller
public class testApplyController {

   	Public Contact Contacty {get;set;}
    Public Contact Contact {get;set;}
    Public Contact Contactx {get;set;}
    public Integer selectedValue{get;set;}
    
    Public  testApplyController(){	    
    }   
       public Contact GetContactx () {   
        Return Contactx;
         }
    public void SetContactx () {   
        system.debug('>>>>>>'+contactx);
        Contactx = contactx;
         }
 
    Public void Contactx(){
        system.debug('---conx---'+contactx);
        If (Contactx ==null){
        String email = 'kevin@caberu.be';
    	Contactx = myutil.getContact(email);       //This does a lookup of a record using myutil.  This works fine.
            } 
        else {
            String email=Contactx.email;
            
       system.debug('-----'+Contactx.Area_of_Activity_Signup__c);
               Contactx = myutil.getContact(email); 
              }            
    } 
    // UPDATE CONTACT INFO
    Public void UpdateContact() { 
        system.debug('---con----'+contactx.Area_of_Activity_Signup__c+contactx.firstname+contactx.MailingCountry);
        Contactx();
        //Contactx= contact;
       System.Debug(contactx.Area_of_Activity_Signup__c);    //Always reverts to the original value
       System.Debug(contactx.firstname); 
       System.Debug(contactx.MailingCountry);  //Always reverts to the original value
        Update Contactx;
        //Apply1();
        //Return null;
    }   
}


 
Can an External Identity User post a document using APEX?
I am having a problem in that Form Assembly is trying to post the results separated by a ',' (comma) instead of a ';' (Semicolon)  There must be a setting to fix this.  I have asked Form Assembly but they have not gotten back to me yet. 
How to allow Community users to edit their related contact fields, but no one elses?
Why are my variables not being called
I cannot figure out what I am doing wrong here.  This was working before.  

MY VF Page
 
<apex:page Controller="TestP" showHeader="false">

<apex:pageBlock><apex:pageBlockSection>
    <apex:form>
   Email given: {!cemail} 
   Email Returned: {!IdentifyUser.email} 
   Name: {!IdentifyUser.name}
    </apex:form>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>


My Controller
public class TestP {
    Public string cemail {get;set;} 
    Public Contact IdentifyUser {get;set;}
    Public Contact x {get;set;}
    
    // IDENTIFY USER BASED ON EMAIL ADDRESS
    Public Contact getIdentifyUser(){       
     cemail='kevin@caberu.be';   
       Contact x = [SELECT Id, firstname, email, name             
              FROM Contact 
              WHERE email = :cemail 
                              LIMIT 1]; 
        Return x;

    }
}


The VF page does not show any of the variables.

Any help is appreciated.  Where is the bug?
I cannot figure out what I am doing wrong here.  This was working before.  

MY VF Page
<apex:page Controller="TestP" showHeader="false">

<apex:pageBlock><apex:pageBlockSection>
    <apex:form>
   Email given: {!cemail} 
   Email Returned: {!IdentifyUser.email} 
   Name: {!IdentifyUser.name}
    </apex:form>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

My Controller
 
public class TestP {
    Public string cemail {get;set;} 
    Public Contact IdentifyUser {get;set;}
    Public Contact x {get;set;}
    
    // IDENTIFY USER BASED ON EMAIL ADDRESS
    Public Contact getIdentifyUser(){       
     cemail='kevin@caberu.be';   
       Contact x = [SELECT Id, firstname, email, name             
              FROM Contact 
              WHERE email = :cemail 
                              LIMIT 1]; 
        Return x;

    }
}

The VF page does not show any of the variables.

Any help is appreciated.  Where is the bug?
I am trying to have a conditional rerender.  I am having trouble with the actionSupport reRender section.  It says I have a syntax error.  Note: I have tried double quotes and single quotes around the None and Person.

<apex:actionSupport event="onkeyup" reRender="{!IF(ISBLANK({!newContact.email})),'None','Person'}"/> 

 <apex:outputLabel id="Person" >        
            Blah Blah                                                            
          </apex:outputLabel>

<apex:outputLabel id="None" >        
            Blah Blah 2           
           </apex:outputLabel>
This is probably just a novice error, but I could use some help on this.  I am trying to return a date field to use on my vf page.  I am taking a date from the Contacct object.  This is my method to get the Contact object:
//  IDENTIFY CONTACT ASSOCIATED WITH CURRENT USER
    public Contact getContact () {
        return[SELECT Id, name, email, MailingAddress, Phone, MailingCity, MailingState, 
                                 MailingCountry,     MailingPostalCode, MailingStreet, 
                                 Membership_Category__c, Membership_End_Date__c, KI_Status__c, 
                                 Membership_Other_Charateristic__c 
               FROM Contact 
               WHERE Id IN (SELECT 	ContactId
                             From User
                             WHERE Id=:UserInfo.getUserId())
              				 LIMIT 1];
	}

I then want to add some years to the date (to make it easy I am just using the integer 3).  I am obviously doing it wrong, but not sure how to fix.  Here is what I tried,
 
// UDPATE MEMBERSHIP END DATE
    public date newEndDate {get;set;}
    
    Public static date UpdateEndDate (){
        Date newEndDate = Contact.Membership_End_Date__c.addYears(3);
       return newEndDate;
   }


 
Hi, I have seen several old, unclear, posts  and no clear documentation on how to pass variables from flow to a controller or VisualForce page.

Can someone either explain with examples or send me to some clear documentation?

Thanks in advance.
Hi I am trying to get that value from a selected list as a variable going to the next VF page.  However, it continues to only give me the default value (2):

VF Page
<apex:page controller="ParameterController">
    <h1>Your latest Membership Status</h1>
  
              <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:form >       
          <p> How Long to extend your ISN membership
          
  <apex:selectList size="1" value="{!SelectedValue}" label="SelectedValue" id="SelectedValue">
        <b>  <apex:selectOptions value="{!dynamiclist}" /></b>
       <p></p>
             <apex:actionSupport event="onchange" reRender="one"  />
</apex:selectList></p><p></p>
             </apex:form>            
              <form id="browserpost" method="POST" action="Page2">
        <input type="hidden" name="namex" value="{!Contact.Name}"/>
        <input type="hidden" name="Payment" value="{!SelectedValue*203}"/> 
        <button type="submit" >
           Make Payment
        </button> 
        <apex:outputLabel id="one" >      You have selected: {!selectedValue} years.       
   The total cost will be: ${!selectedValue*203}   </apex:outputLabel>
    </form><p></p>    
              </apex:pageBlockSection>
    </apex:pageBlock> 
</apex:page>
Relevant Contoller:
 
// DROP DOWN LIST FOR YEARS TO RENEW 
    public Integer selectedValue {
    get
    {
       if(selectedValue==null)
           selectedValue=2;
 return selectedValue;   }
set;        
}

 public List<SelectOption> getdynamiclist() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','1 year'));
        options.add(new SelectOption('2','2 years'));
        options.add(new SelectOption('3','3 years'));
         options.add(new SelectOption('4','4 years'));
        options.add(new SelectOption('5','5 years'));
        return options;
    
    }

Any help would be appreciated!


 
I will preface this that I am fairly new at creating a controller so there several poor practices going on here.

The first Class (Contact) works fine.  and I am trying to use it to help me get the related membership to the identified contact.  I have tried several ways to get it done, but keep running into errors.  I feel I am close, but that is only good with hand grenades and horse shoes.

Here is part of my Controller:
 
public Contact getContact () {
        
        return[SELECT Id, name, email, MailingAddress, Phone, MailingCity, MailingState, MailingCountry, MailingPostalCode, MailingStreet 
               FROM Contact 
               WHERE Id IN (SELECT 	ContactId
                             From User
                             WHERE Id=:UserInfo.getUserId())
              LIMIT 1];

    }
  public Membership__c getMembership () {
        
        return[SELECT Id
               FROM Membership__c
               WHERE Contact_Associated__c = {!Contact.Id}
              LIMIT 1];
}

 
I would like to see the profiles pictures of the users in Communities in my Salesforce Org.  I would like to have them replicated to the Contact Object, but would at least like to look at them in the User Object.  I am not sure where to find them.  Any help is appreciated.
 
Hi, I am trying to a field from the active user in a component and use it in an if statement.

 <aura:if isTrue="{!$User.IsActive}">
    <td class="button"><a href="#" target="_blank">
               <lightning:button label="Join"/></a></td>
    <aura:set attribute="else">
        <td class="button"><a href="#" target="_blank">
               <lightning:button label="Renew Membership"/></a></td>
    </aura:set>
</aura:if>


I assume I am using the wrong syntax for {!$User.IsActive} as it always throws up the else and IsActive is definitely TRUE for the current user.

Thanks for any help
Two problems with the Communities Register Template:
 
1) When I select "Forgot password?" and then click "cancel", the startURL is changed so that it goes to communities rather than the app that started the process.  I need it to go to the app.
 
2) When I add Country as an extra field, it is not a drop down list (as it is in my org) but it is a free fill field which will cause problems.
 
Any ideas? 
Why are my variables not being called
I cannot figure out what I am doing wrong here.  This was working before.  

MY VF Page
 
<apex:page Controller="TestP" showHeader="false">

<apex:pageBlock><apex:pageBlockSection>
    <apex:form>
   Email given: {!cemail} 
   Email Returned: {!IdentifyUser.email} 
   Name: {!IdentifyUser.name}
    </apex:form>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>


My Controller
public class TestP {
    Public string cemail {get;set;} 
    Public Contact IdentifyUser {get;set;}
    Public Contact x {get;set;}
    
    // IDENTIFY USER BASED ON EMAIL ADDRESS
    Public Contact getIdentifyUser(){       
     cemail='kevin@caberu.be';   
       Contact x = [SELECT Id, firstname, email, name             
              FROM Contact 
              WHERE email = :cemail 
                              LIMIT 1]; 
        Return x;

    }
}


The VF page does not show any of the variables.

Any help is appreciated.  Where is the bug?
I am having a challenge passing a value selected/entered on a visual force page to the apex controller.  This should just work, but for some reason it is not working.  The value in the controller always reverts to the original value. Can you find the error in my code?
 
<apex:page standardStylesheets="false" controller="testApplyController" showHeader="false" action="{!contactx}">
    
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"></link>
    <meta charset="utf-8" />
    <apex:stylesheet value="{!URLFOR($Resource.customCSS)}"/>

    <title></title>

</head>
<body>
    <div class="ctr">
        <h2 class="title">
           Let's get started.
        </h2>
    </div>
    <br />
    <div class="centerform" >
        <form action="/" method="post"><apex:form >
            <table class="table-main">
                
                <tr>
                    <td style="min-width:270px; padding-right: 1em;">

                        Enter your email address   <br />
                         <apex:inputfield value="{!Contactx.email}" label="email" html-class="form-control" />
                       
                    </td>
                    <td style="min-width:270px; padding-right: 1em;">
                        What is your area of activity? <i class="fa fa-info-circle"  style="color:dimgrey" data-toggle="modal" data-target="#Roles"></i>     <br />
                        <apex:inputfield value="{!Contactx.Area_of_Activity_Signup__c}" label="activity" html-class="form-control"/>
                   		
                    </td>
                    <td style="min-width:270px; padding-right: 1em;">
                        Where do you live? <br />
                      <apex:inputfield value="{!Contactx.MailingCountryCode}" label="Country" html-class="form-control"/> 
                       
                    </td>
                </tr>
                 
            </table>

        </apex:form>  </form>
        <br />
    </div>

    <div class="ctr">
        <Apex:form > <Apex:commandButton styleclass="button back" style="color:teal; margin-right:10px;" action="{!UpdateContact}" value="back"   /> 
                    &nbsp;&nbsp;&nbsp;
        <Apex:commandButton styleclass="button" style="color:white;" action="{!UpdateContact}" value="Update"  /> </Apex:form>
     <!--   <button class="button back" style="color:teal; margin-right:10px;">back</button>

        <button class="button" style="color:white">next</button>
          --> 
    </div>
    <br /><br />
</body>
</html>
</apex:page>
Controller
public class testApplyController {

   	Public Contact Contacty {get;set;}
    Public Contact Contact {get;set;}
    Public Contact Contactx {get;set;}
    public Integer selectedValue{get;set;}
    
    Public  testApplyController(){	    
    }   
       public Contact GetContactx () {   
        Return Contactx;
         }
    public void SetContactx () {   
        system.debug('>>>>>>'+contactx);
        Contactx = contactx;
         }
 
    Public void Contactx(){
        system.debug('---conx---'+contactx);
        If (Contactx ==null){
        String email = 'kevin@caberu.be';
    	Contactx = myutil.getContact(email);       //This does a lookup of a record using myutil.  This works fine.
            } 
        else {
            String email=Contactx.email;
            
       system.debug('-----'+Contactx.Area_of_Activity_Signup__c);
               Contactx = myutil.getContact(email); 
              }            
    } 
    // UPDATE CONTACT INFO
    Public void UpdateContact() { 
        system.debug('---con----'+contactx.Area_of_Activity_Signup__c+contactx.firstname+contactx.MailingCountry);
        Contactx();
        //Contactx= contact;
       System.Debug(contactx.Area_of_Activity_Signup__c);    //Always reverts to the original value
       System.Debug(contactx.firstname); 
       System.Debug(contactx.MailingCountry);  //Always reverts to the original value
        Update Contactx;
        //Apply1();
        //Return null;
    }   
}


 
How to allow Community users to edit their related contact fields, but no one elses?
Why are my variables not being called
I cannot figure out what I am doing wrong here.  This was working before.  

MY VF Page
 
<apex:page Controller="TestP" showHeader="false">

<apex:pageBlock><apex:pageBlockSection>
    <apex:form>
   Email given: {!cemail} 
   Email Returned: {!IdentifyUser.email} 
   Name: {!IdentifyUser.name}
    </apex:form>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>


My Controller
public class TestP {
    Public string cemail {get;set;} 
    Public Contact IdentifyUser {get;set;}
    Public Contact x {get;set;}
    
    // IDENTIFY USER BASED ON EMAIL ADDRESS
    Public Contact getIdentifyUser(){       
     cemail='kevin@caberu.be';   
       Contact x = [SELECT Id, firstname, email, name             
              FROM Contact 
              WHERE email = :cemail 
                              LIMIT 1]; 
        Return x;

    }
}


The VF page does not show any of the variables.

Any help is appreciated.  Where is the bug?
I cannot figure out what I am doing wrong here.  This was working before.  

MY VF Page
<apex:page Controller="TestP" showHeader="false">

<apex:pageBlock><apex:pageBlockSection>
    <apex:form>
   Email given: {!cemail} 
   Email Returned: {!IdentifyUser.email} 
   Name: {!IdentifyUser.name}
    </apex:form>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

My Controller
 
public class TestP {
    Public string cemail {get;set;} 
    Public Contact IdentifyUser {get;set;}
    Public Contact x {get;set;}
    
    // IDENTIFY USER BASED ON EMAIL ADDRESS
    Public Contact getIdentifyUser(){       
     cemail='kevin@caberu.be';   
       Contact x = [SELECT Id, firstname, email, name             
              FROM Contact 
              WHERE email = :cemail 
                              LIMIT 1]; 
        Return x;

    }
}

The VF page does not show any of the variables.

Any help is appreciated.  Where is the bug?
This is probably just a novice error, but I could use some help on this.  I am trying to return a date field to use on my vf page.  I am taking a date from the Contacct object.  This is my method to get the Contact object:
//  IDENTIFY CONTACT ASSOCIATED WITH CURRENT USER
    public Contact getContact () {
        return[SELECT Id, name, email, MailingAddress, Phone, MailingCity, MailingState, 
                                 MailingCountry,     MailingPostalCode, MailingStreet, 
                                 Membership_Category__c, Membership_End_Date__c, KI_Status__c, 
                                 Membership_Other_Charateristic__c 
               FROM Contact 
               WHERE Id IN (SELECT 	ContactId
                             From User
                             WHERE Id=:UserInfo.getUserId())
              				 LIMIT 1];
	}

I then want to add some years to the date (to make it easy I am just using the integer 3).  I am obviously doing it wrong, but not sure how to fix.  Here is what I tried,
 
// UDPATE MEMBERSHIP END DATE
    public date newEndDate {get;set;}
    
    Public static date UpdateEndDate (){
        Date newEndDate = Contact.Membership_End_Date__c.addYears(3);
       return newEndDate;
   }


 
Hi, I have seen several old, unclear, posts  and no clear documentation on how to pass variables from flow to a controller or VisualForce page.

Can someone either explain with examples or send me to some clear documentation?

Thanks in advance.
Hi I am trying to get that value from a selected list as a variable going to the next VF page.  However, it continues to only give me the default value (2):

VF Page
<apex:page controller="ParameterController">
    <h1>Your latest Membership Status</h1>
  
              <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:form >       
          <p> How Long to extend your ISN membership
          
  <apex:selectList size="1" value="{!SelectedValue}" label="SelectedValue" id="SelectedValue">
        <b>  <apex:selectOptions value="{!dynamiclist}" /></b>
       <p></p>
             <apex:actionSupport event="onchange" reRender="one"  />
</apex:selectList></p><p></p>
             </apex:form>            
              <form id="browserpost" method="POST" action="Page2">
        <input type="hidden" name="namex" value="{!Contact.Name}"/>
        <input type="hidden" name="Payment" value="{!SelectedValue*203}"/> 
        <button type="submit" >
           Make Payment
        </button> 
        <apex:outputLabel id="one" >      You have selected: {!selectedValue} years.       
   The total cost will be: ${!selectedValue*203}   </apex:outputLabel>
    </form><p></p>    
              </apex:pageBlockSection>
    </apex:pageBlock> 
</apex:page>
Relevant Contoller:
 
// DROP DOWN LIST FOR YEARS TO RENEW 
    public Integer selectedValue {
    get
    {
       if(selectedValue==null)
           selectedValue=2;
 return selectedValue;   }
set;        
}

 public List<SelectOption> getdynamiclist() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','1 year'));
        options.add(new SelectOption('2','2 years'));
        options.add(new SelectOption('3','3 years'));
         options.add(new SelectOption('4','4 years'));
        options.add(new SelectOption('5','5 years'));
        return options;
    
    }

Any help would be appreciated!


 
I will preface this that I am fairly new at creating a controller so there several poor practices going on here.

The first Class (Contact) works fine.  and I am trying to use it to help me get the related membership to the identified contact.  I have tried several ways to get it done, but keep running into errors.  I feel I am close, but that is only good with hand grenades and horse shoes.

Here is part of my Controller:
 
public Contact getContact () {
        
        return[SELECT Id, name, email, MailingAddress, Phone, MailingCity, MailingState, MailingCountry, MailingPostalCode, MailingStreet 
               FROM Contact 
               WHERE Id IN (SELECT 	ContactId
                             From User
                             WHERE Id=:UserInfo.getUserId())
              LIMIT 1];

    }
  public Membership__c getMembership () {
        
        return[SELECT Id
               FROM Membership__c
               WHERE Contact_Associated__c = {!Contact.Id}
              LIMIT 1];
}

 
Hi, I am trying to a field from the active user in a component and use it in an if statement.

 <aura:if isTrue="{!$User.IsActive}">
    <td class="button"><a href="#" target="_blank">
               <lightning:button label="Join"/></a></td>
    <aura:set attribute="else">
        <td class="button"><a href="#" target="_blank">
               <lightning:button label="Renew Membership"/></a></td>
    </aura:set>
</aura:if>


I assume I am using the wrong syntax for {!$User.IsActive} as it always throws up the else and IsActive is definitely TRUE for the current user.

Thanks for any help