• joestuart
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 14
    Replies
We are having strange things happen on our shopping cart that is hosted on a SFDC site.  Is there any way to track the user's movements (what pages they go to and a time stamp)?
We want to track to see if they are clicking the back button for example. 
Thanks.
Hi, 
I want to introduce version control into my workflow.  I also want to work locally.  I have a Bitbucket account that I would like to use.

Currently I work in the Developer consoole in the sandbox and deploy from there.  

Any advice would be appricated.
Thanks
Hello friendly people,

Over the weekend my site has stopped working correctly.  I have isolated the problem and it seems to be the Product obj's fields that won't display.

They display when I am logged in and preview the Visualforce page but when I view without being loggin into SFDC on the force.com URL it dosen't display the fields.  I have checked the field level security and it has read enabled.  

I'm still on Summer '18.

Did something happen over the weekend?  My code has been working for the last 6 months with no issues.
FYI this is my code:
<apex:outputField value="{!Product.Standard_Investment_Details__c}"/>

Thank you for your help.
Hi,
If someone could please help me fix my test.  I am trying to deploy my code but stuck in the Test with the error: 
System.NullPointerException: Attempt to de-reference a null object
Stack Trace
Class.webBookingEventsCon.processEvent: line 920, column 1
Class.webBookingEventsCon.eventPayNow: line 1019, column 1
Class.webBookingEventsConTest.webBookingEventsConUnitTest: line 152, column 1

Here is my test
/**
 *t
 */
@isTest
private class webBookingEventsConTest {

    static testMethod void webBookingEventsConUnitTest() {
        
        // **** Setup Test Data *****
        
        Product2 product = new Product2( 
            Discounted_Price_Theshold__c=3, 
            Table_Size__c=7, 
            Discounted_Investment_Description__c='A discount of $50pp applies for 3 or more people', 
            Table_Investment_Details__c=3750.00, 
            Discounted_Investment_Details__c=545.00, 
            Standard_Investment_Details__c=595.00, 
            Name='Test Course',
            GST__c=true,
            IsActive=true);
        insert product;
        
        List<Campaign> campaignList = new List<Campaign>();
        campaignList.add(new Campaign (
            Name='Test Event - 30 days out',
            Venue_Name__c='The Venue',
            Address_Details__c='100 Flinders St, Melbourne', 
            StartDate=system.today()+30, 
            Running_Times__c='9am start',
            Event_Type__c = 'Workshop', 
            Product_Name__c=product.Id, 
            Location__c='Melbourne', 
            IsActive=true,
            Opportunity_Category__c='VIC Public Program',
            Publish_on_the_web__c = true));  
        campaignList.add(new Campaign (
            Name='Test Event - 90 days out',
            Venue_Name__c='The Venue',
            Address_Details__c='100 Flinders St, Melbourne', 
            StartDate=system.today()+90, 
            Running_Times__c='9am start', 
            Product_Name__c=product.Id, 
            Location__c='Melbourne', 
            Opportunity_Category__c='VIC Public Program',
            IsActive=true,
            Publish_on_the_web__c = true)); 
        insert campaignList;
        
        
        Account account = new Account(Name='Test Co Pty Ltd');
        insert account;
        
        Contact contact = new Contact(firstName='TestFN',LastName='TestLN',email='testfn.testln@test.com',AccountId=account.Id);
        insert contact;
        
        // ** Start Testing ***/
        PageReference pageRef = new PageReference('/apex/eventsSelectList?prodId='+product.Id);
        Test.setCurrentPage(pageRef);

        webBookingEventsCon controller = new webBookingEventsCon();
        
        system.assertEquals(2, controller.upcommingEvents.size(), 'Check 2 upcomming events found');        
        
        system.assertEquals(product.Id,controller.Product.Id,'check product loaded');
        
        system.assert(controller.noIndividualsList.size()>0,'Load and check Individuals Picklist Ok');    
        
        system.assert(controller.noGroupsList.size()>0,'Load and check Groups Picklist Ok');  

        // >>> Events Select, plus select No. of Attenddee's        
        controller.eventSelectConfirm(); // fails no campaign
        controller.campaignId='000';
        
        controller.eventSelectConfirm(); // fails no Individual or groups selected
        controller.payment.No_Of_Groups__c='2';
        controller.payment.No_Of_Individuals__c='1';
        
        //Added for GST
        controller.payment.total_GST__c ='100';
        
        controller.eventSelectConfirm(); // fails indvalid campaign
        controller.campaignId=campaignList[0].Id;
        
        string nextURL = controller.eventSelectConfirm().getUrl();
        system.assertEquals('/apex/eventsregistration',nextURL,'Should go onto Events Registration entry screen');
        
        // >>> Events Registration   
        Contact primaryContact = controller.primaryContact;  
        primaryContact.firstName='TestFN';
        primaryContact.LastName='TestLN';
        primaryContact.Phone='03 9397 9999';
        primaryContact.Email='testfn.testln@test.com';
        primaryContact.Organisation__c='Test Co Pty Ltd';
   
        controller.primaryContact = primaryContact;         
        controller.IWillAttend = true;
        
        nextURL = controller.eventRegistrationConfirm().getUrl();
        system.assertEquals('/apex/eventsattendees',nextURL,'Should go onto Events Attenddee entry screen');        
        
        // >>> Events Attenddee registration
        controller.attendeeSaveAndAdd();
        system.assertEquals(2, controller.currentNoAttenddee, 'Should have saved first attendde (defaulted) and be waiting for second.');
        
        controller.currAttendeeContact.contact.lastName='G1.1';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.2';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.3';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.4';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.5';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.6';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G1.7';
        controller.attendeeSaveAndAdd();
        
        controller.currAttendeeContact.contact.lastName='G2.1';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G2.2';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G2.3';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G2.4';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G2.5';
        controller.attendeeSaveAndAdd();
        controller.currAttendeeContact.contact.lastName='G2.6';
        controller.attendeeSaveAndAdd();
        
        
        controller.currentNoAttenddee = 2;
        controller.attendeeEdit();
        system.assertEquals(controller.currAttendeeContact.contact.lastName,'G1.1','Check Controller Edit');
        controller.attendeeSaveAndAdd();
        
        controller.currentNoAttenddee = 2;
        controller.attendeeDel();
        system.assertEquals(13,controller.attendeeContacts.size(), 'Check attendee deleted OK');
        
        
        
        controller.eventPayNow(); // should fail, not enough attenddess;
        
        controller.currAttendeeContact.contact.lastName='G2.7';
        controller.attendeeSaveAndAdd();
        
        system.assertEquals('Save',controller.attenddeeSaveMode,'Should be in save mode as now adding last item.');
        controller.currAttendeeContact.contact.lastName='G2.1';
        controller.attendeeSaveAndAdd();
                
        controller.eventPayNow();   
        
        List<CampaignMember> campaignMemberList = new List<CampaignMember>([Select Id from CampaignMember where campaignId = :campaignList[0].Id]);
        System.assertEquals(15,campaignMemberList.size(),'Check details updated - campaign members');
        
        
        // >>> Post payment update.
        AAkPay__Payment_Txn__c paymentTxn = new AAkPay__Payment_Txn__c(AAkPay__Payment_Response_Code__c='00',AAkPay__Campaign__c=campaignList[0].Id,AAkPay__Card_Charged_Amount__c=500,Payment__c=controller.payment.Id);
        insert paymentTxn;
        
        ApexPages.currentPage().getParameters().put('id',paymentTxn.Id);
        controller.eventsCheckOutConfirmInit();
        
        Payment__c payment2 = ([Select Id, Paid_In_Full__c from Payment__c where Id = :controller.payment.Id]);
        system.assertEquals(true,Payment2.Paid_In_Full__c,'Check post payment updates completed OK');
                    
        AAkonsultUtils.errorLog('eventCon.eventsCheckOutConfirmInit','test Subject ','test description',null);                                                  
    }
}

Thank you for any help.
Joe​​
Hi,

I have a Checkbox (GST__c) on an object called Product2, I want to  check to see if it is checked, if it is checked then apply TAX if not checked don't apply TAX.

This is what i have come up with, do I need to wrap my conditional statement in a function?
Thanks.
public Product2 product { get {
        if (product == null) { 
            try {
                product = ([Select  GST__c from Product2 where Id = :prodId]);
            } Catch (Exception e) { }
        }
        return product;
    } set; }
    
    public Boolean GSTRequired {get; set;}

if(product.GST__c == true){
  // Tax required
  GSTRequired = true;
} else {
   // Tax not required
   GSTRequired = false;
}

 
Hi,
I have stripped my code back to the bare minumum as I am having lots of trouble trying to make a form with one field.  The field needs to submit the string "submitted" when the user hits the submit button.

My Error in the VFP
<blockquote>Unknown property 'leadershipReadyCon.Leadership_Ready__c'</blockquote>

My APEX Class code
public with sharing class leadershipReadyCon {

	 public final Leadership_Ready__c myLeadershipReady;
    
	//Constructor function
    public leadershipReadyCon() {
        myLeadershipReady = [SELECT Id, Automated_TP_Status__c FROM Leadership_Ready__c 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('prodId')];
    }
    
    Leadership_Ready__c lr = new Leadership_Ready__c();
    
    

    public Leadership_Ready__c getLeadershipReady() {
        return myLeadershipReady;
    }

    public PageReference save() {
        //Add your custom logic to update specific fields here 
        //e.g. myLeadershipReady.email = 'xx@xx.com'; 
        update myLeadershipReady;
        return null;
    }        
}

Here is my Visual Force Page code 
<apex:page controller="leadershipReadyCon" tabStyle="Leadership_Ready__c">
    
    <apex:form >
        
        <apex:pageBlock title="Automated Training Plan Status">
            You belong to Account Name: <apex:inputField value="{!Leadership_Ready__c.Automated_TP_Status__c}"/>
            <apex:commandButton action="{!save}" value="save"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Any help would be great, I don't know if this is the best way to submit data to a field in SFDC with APEX so if I am totaly on the wrong track, please let me know.

Thanks.
Hi

I have made a wordpress module that creates a connection to Salesforce. The modules all work fine when they are the only widgets on the page.

The problem is that I have multiple modules on the page and they are all trying to start a new connection and it only allows for one connection.
try {
  $mySforceConnection = new SforceEnterpriseClient();
 
  $mySoapClient = $mySforceConnection->createConnection( $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/widgets/enterprise.wsdl.xml");
 
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
So my question is, what is the best way to make a connection under my circumstances? Should I make a connection in the first module and then on the following modules check to see if a connection is established and if so get session Id?  How should this be done securely  With PHP super globals "$_GET"?  

Thank you.
Hi I have just successfuly made my Class that checks a custom field in oppertunities, saves the object and then redirects to a thankyou page.  

I have tested it and I got 100% code coverage and when I test the page (logged in to salesforce) it works perfectly but when I test it on the public site, the VF pages work but when I click on the submit button it just reloads the page and dosen't fire off the class.  

I have added the VF pages to my web profile and the class too but I think there is still somthing that I need to do to make the class public....  I think it is something to do with the access of the APEX class.

Thank you.

Here is my class FYI

public class proteusProposalCon {
private ApexPages.StandardController controller;
public proteusProposalCon(ApexPages.StandardController controller) {
this.controller = controller;
}

  public PageReference saveAndCongrat() {
  controller.save(); // This takes care of the details for you.
  PageReference congratsPage = Page.thankyou;
  congratsPage.setRedirect(true);
  return congratsPage;
}
}

Hi,

 

This is my first force page form and I need to make a form with pre-populated fields and fields that need to be manually filled out.

The fields that are pre-populated will be populated from "campaign" but I don't want to update the campaign I want the form to save the data to "Cases" as it is a feedback form about a campaign.

 

This is the code I have so far, these are the fields that I want to pre populate.

 

<apex:page standardController="Campaign" sidebar="false">
<apex:pageBlock >
    <apex:form >
        <apex:pageblockSection >
            
             <apex:inputField value="{!Campaign.Organising_Contact__c}"/>
            <apex:inputField value="{!Campaign.Organising_Contact_Company__c}"/>
            <apex:inputField value="{!Campaign.Organising_Contact_Email__c}"/>
            <apex:inputField value="{!Campaign.Long_Start_Date__c}"/>
            <apex:inputField value="{!Campaign.Product_Name__c}"/>
            <apex:inputField value="{!Campaign.Facilitator__c}"/>
            <apex:commandButton action="{!save}" value="Save!"/>
        </apex:pageblockSection>
    </apex:form>
</apex:pageBlock>
</apex:page>

 But when I save it will update the controller "Campaign" so how do I tell it to make a new case and save it to "Cases"

 

Thank you in advance.  

I am new to force pages so I would appreciate any help on this or even if someone could point me in the right direction.

 

Joe

 

 

Hi, 
I want to introduce version control into my workflow.  I also want to work locally.  I have a Bitbucket account that I would like to use.

Currently I work in the Developer consoole in the sandbox and deploy from there.  

Any advice would be appricated.
Thanks
Hello friendly people,

Over the weekend my site has stopped working correctly.  I have isolated the problem and it seems to be the Product obj's fields that won't display.

They display when I am logged in and preview the Visualforce page but when I view without being loggin into SFDC on the force.com URL it dosen't display the fields.  I have checked the field level security and it has read enabled.  

I'm still on Summer '18.

Did something happen over the weekend?  My code has been working for the last 6 months with no issues.
FYI this is my code:
<apex:outputField value="{!Product.Standard_Investment_Details__c}"/>

Thank you for your help.
Hi,
I have stripped my code back to the bare minumum as I am having lots of trouble trying to make a form with one field.  The field needs to submit the string "submitted" when the user hits the submit button.

My Error in the VFP
<blockquote>Unknown property 'leadershipReadyCon.Leadership_Ready__c'</blockquote>

My APEX Class code
public with sharing class leadershipReadyCon {

	 public final Leadership_Ready__c myLeadershipReady;
    
	//Constructor function
    public leadershipReadyCon() {
        myLeadershipReady = [SELECT Id, Automated_TP_Status__c FROM Leadership_Ready__c 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('prodId')];
    }
    
    Leadership_Ready__c lr = new Leadership_Ready__c();
    
    

    public Leadership_Ready__c getLeadershipReady() {
        return myLeadershipReady;
    }

    public PageReference save() {
        //Add your custom logic to update specific fields here 
        //e.g. myLeadershipReady.email = 'xx@xx.com'; 
        update myLeadershipReady;
        return null;
    }        
}

Here is my Visual Force Page code 
<apex:page controller="leadershipReadyCon" tabStyle="Leadership_Ready__c">
    
    <apex:form >
        
        <apex:pageBlock title="Automated Training Plan Status">
            You belong to Account Name: <apex:inputField value="{!Leadership_Ready__c.Automated_TP_Status__c}"/>
            <apex:commandButton action="{!save}" value="save"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Any help would be great, I don't know if this is the best way to submit data to a field in SFDC with APEX so if I am totaly on the wrong track, please let me know.

Thanks.
Hi

I have made a wordpress module that creates a connection to Salesforce. The modules all work fine when they are the only widgets on the page.

The problem is that I have multiple modules on the page and they are all trying to start a new connection and it only allows for one connection.
try {
  $mySforceConnection = new SforceEnterpriseClient();
 
  $mySoapClient = $mySforceConnection->createConnection( $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/widgets/enterprise.wsdl.xml");
 
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
So my question is, what is the best way to make a connection under my circumstances? Should I make a connection in the first module and then on the following modules check to see if a connection is established and if so get session Id?  How should this be done securely  With PHP super globals "$_GET"?  

Thank you.
Hi I have just successfuly made my Class that checks a custom field in oppertunities, saves the object and then redirects to a thankyou page.  

I have tested it and I got 100% code coverage and when I test the page (logged in to salesforce) it works perfectly but when I test it on the public site, the VF pages work but when I click on the submit button it just reloads the page and dosen't fire off the class.  

I have added the VF pages to my web profile and the class too but I think there is still somthing that I need to do to make the class public....  I think it is something to do with the access of the APEX class.

Thank you.

Here is my class FYI

public class proteusProposalCon {
private ApexPages.StandardController controller;
public proteusProposalCon(ApexPages.StandardController controller) {
this.controller = controller;
}

  public PageReference saveAndCongrat() {
  controller.save(); // This takes care of the details for you.
  PageReference congratsPage = Page.thankyou;
  congratsPage.setRedirect(true);
  return congratsPage;
}
}
I'm drawing a blank on how to use the standard {!Save} function in my visualforce on the command button. Basically after I click Save I want to redirect the page into a new page.

Here is my VF page code

<apex:page standardController="Lead" recordSetVar="leads" id="thePage" showHeader="true" sidebar="false" extensions="extContactApprovalPage" >
 
  <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!leads}" var="l">
                <apex:column >
                    <apex:outputField value="{!l.Name}"/>
                    <apex:facet name="header">Registrant Name</apex:facet>
                </apex:column>
               
                <apex:column >
                    <apex:outputField value="{!l.Approve_Picklist__c}"/>
                    <apex:facet name="header">Approve Picklist</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:outputField value="{!l.Approve_Checkbox__c}"/>
                    <apex:facet name="header">Approve Checkbox</apex:facet>
                </apex:column>
               
              <apex:inlineEditSupport event="onClick" showOnEdit="saveButton, cancelButton"/>
             
          </apex:pageBlockTable>
          <apex:pageBlockButtons >
                <!--<apex:commandButton value="Edit" action="{!save}" id="editButton" />-->
                <apex:commandButton value="Save" action="{!save}" id="saveButton" reRender="none" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
            </apex:pageBlockButtons>
      </apex:pageBlock>
 
  </apex:form>
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page: ContactApprovalPage
  <!-- End Default Content REMOVE THIS -->
</apex:page>

and here is my extension:

public class extContactApprovalPage {

    public extContactApprovalPage(ApexPages.StandardSetController controller) {
      
    }
   
    public PageReference save(){
       
        
        PageReference reRend = new PageReference('/003');
        return reRend;
    }

}

Any assistance would be great thanks.

Hi Can someone please help me write a test so I can deploy an APEX class.

 

I had to edit some previous code that someone wrote and I am try to learn APEX and Force and read some articles on testing but don't have a clue on how/ what to test in my code.  Coming from a web designer background you just test it in the browser and  it's all good.

 

public with sharing class EventListsStates {

    private static string prodId;
    private static string noRows;
            
    public EventListsStates() {
        prodId = ApexPages.currentPage().getParameters().get('prodId');
        noRows = ApexPages.currentPage().getParameters().get('noRows');
        noRows = (noRows == null || noRows == '') ? '5' : noRows; 

    }
  
    public Campaign campaign {get ;set ;}

   public list<Campaign> upcommingEventsNSW {get {
        if (upcommingEventsNSW == null) {
            
            upcommingEventsNSW = new List<Campaign>([Select Name,Opportunity_Category__c,Event_Date__c,Venue_Name__c,Event_Month__c,Event_Day__c,Address_Details__c, StartDate, Running_Times__c, Product_Name__c, Location__c, IsActive From Campaign  where Location__c = 'Sydney' and startdate >= today and IsActive = True and Publish_on_the_web__c = true and Product_Name__c = :prodId order by startDate ASC limit :integer.valueOf(noRows)]);
        }
        return upcommingEventsNSW;
    } set;}
    
  
        
}

 Thank you!!

 

Joe

Hi,

 

This is my first force page form and I need to make a form with pre-populated fields and fields that need to be manually filled out.

The fields that are pre-populated will be populated from "campaign" but I don't want to update the campaign I want the form to save the data to "Cases" as it is a feedback form about a campaign.

 

This is the code I have so far, these are the fields that I want to pre populate.

 

<apex:page standardController="Campaign" sidebar="false">
<apex:pageBlock >
    <apex:form >
        <apex:pageblockSection >
            
             <apex:inputField value="{!Campaign.Organising_Contact__c}"/>
            <apex:inputField value="{!Campaign.Organising_Contact_Company__c}"/>
            <apex:inputField value="{!Campaign.Organising_Contact_Email__c}"/>
            <apex:inputField value="{!Campaign.Long_Start_Date__c}"/>
            <apex:inputField value="{!Campaign.Product_Name__c}"/>
            <apex:inputField value="{!Campaign.Facilitator__c}"/>
            <apex:commandButton action="{!save}" value="Save!"/>
        </apex:pageblockSection>
    </apex:form>
</apex:pageBlock>
</apex:page>

 But when I save it will update the controller "Campaign" so how do I tell it to make a new case and save it to "Cases"

 

Thank you in advance.  

I am new to force pages so I would appreciate any help on this or even if someone could point me in the right direction.

 

Joe