• knthornt1
  • NEWBIE
  • 50 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 13
    Replies

Built a controller and an visualforce page. Trying to gather records from an object and then use <apex:repeat> to display them on the page. Here's the controller code:

 

public class MyCustomRentalExtension {
	
	//The standard controller on which this extension is based
	Custom_Rental__c rental;
	
	//Properties of this class
	public String booth {get;set;}
	List<Custom_Rental__c> allSizes = new List<Custom_Rental__c>();
	
	//Constructor
	public MyCustomRentalExtension() {
		//set the default size
		booth = '10x10';
		
		//on page load, get the size param from the URL 
		String sizeParam = ApexPages.currentPage().getParameters().get('booth');
		if (sizeParam != ''){
			for (Custom_Rental__c cr : allSizes){
				if(cr.Booth__c == sizeParam){
					booth = cr.Booth__c;
				}
			}
		}
	}
	
	
	//List records for a specific booth size
	public List<Custom_Rental__c> getBooths() {
		return [Select p.id, p.File_Name__c, p.Preview_Link__c from Custom_Rental__c p where p.Booth__c = :booth Order By p.File_Name__c];
	}
}

Here is the VF Page:

<apex:page showHeader="false" id="body" standardStylesheets="false" controller="MyCustomRentalExtension" cache="true" expires="600">
<head>
<title>{!booth} Customer Rental Extension Site</title></head>

<h2> {!booth} Custom Rental Portfolio</h2><br/>
<p>To learn more about our {!booth} custom rental solutions click on one of the booth photographs below.</p><br/>

<apex:form id="form">
	<apex:outputPanel id="list">
		<apex:repeat value="{!Booths}" var="booth" id="boothList">
			<div style="float: left; padding:0; margin:0px 15px 15px 0px;">
				<h4 align="center">{!booth.File_Name__c}</h4>
				<div style="border: 2px solid #e2e2e2; margin:0; padding:2px;">
					<a href="Page1?id={booth.id}">
						<img src="{!booth.Preview_Link__c}" width="250" height="200" alt="{!booth.Name}" />
						</a>
						</div>
					</div>
				</apex:repeat>
			</apex:outputPanel>
		</apex:form>

</apex:page>

 

 I am getting an error on the VF page saying "Unknown Property 'String.File_Name__c'

I have an authenticated site where some users can switch the account which drives the data displayed on the site. The account could be either the one tied to the portal users account (the one the contact record is tied to) or another account which is a child account (though the parent account hierarchy).

 

Users can submit a record which essentailly just updates a date on the record. This date triggers an workflow email alert. When the user submits a record tied to "their" account, there is no problem, but when the user submits a record against a different account an Invalid Cross Reference ID error is thrown. The error occurs as the workflow is evaluated. Turning off the email alert results in a successful submission.

 

The workflow email alert does use a visualforce template, but I removed all the markup from that template and no error was thrown.

 

Error log below. Any help at all would be appreciated.

 

16:41:02.646 (1646850000)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01IA0000001wgKG
16:41:02.691 (1691668000)|WF_RULE_EVAL_BEGIN|Assignment
16:41:02.691 (1691690000)|WF_RULE_EVAL_BEGIN|Response
16:41:02.691 (1691699000)|WF_RULE_EVAL_BEGIN|Workflow
16:41:02.691 (1691724000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping - Placed Thank You|01QA00000005Dqb|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.698 (1698456000)|WF_RULE_FILTER|[Shipping Schedule Header : Ordered Date not equal to null]
16:41:02.698 (1698480000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.698 (1698488000)|WF_CRITERIA_END|true
16:41:02.715 (1715916000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping 6 month confirm|01QA00000005Dqc|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.715 (1715985000)|WF_RULE_FILTER|[Shipping Schedule Header : Confirmation Date equals null]
16:41:02.716 (1716005000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.716 (1716014000)|WF_CRITERIA_END|false
16:41:02.716 (1716029000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Place Order reminder|01QA00000005DqZ|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.716 (1716455000)|WF_RULE_NOT_EVALUATED
16:41:02.716 (1716540000)|WF_SPOOL_ACTION_BEGIN|Workflow
16:41:02.716 (1716564000)|WF_RULE_INVOCATION|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]
16:41:02.716 (1716578000)|WF_EMAIL_ALERT|Id=01WA00000008rih|CurrentRule:Portal Shipping - Placed Thank You (Id=01QA00000005Dqb)
16:41:02.809 (1809641000)|WF_ACTION| Email Alert: 1;
16:41:02.809 (1809660000)|WF_RULE_EVAL_BEGIN|Escalation
16:41:02.809 (1809667000)|WF_RULE_EVAL_END
16:41:02.809 (1809675000)|WF_TIME_TRIGGERS_BEGIN
16:41:02.809 (1809751000)|WF_ACTIONS_END| Email Alert: 1;
16:41:02.809 (1809757000)|CODE_UNIT_FINISHED|Workflow:01IA0000001wgKG
16:41:02.809 (1809920000)|DML_END|[258]
16:41:02.810 (1810050000)|EXCEPTION_THROWN|[258]|System.DmlException: Update failed. First exception on row 0 with id a2AA00000000Bn1MAE; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
16

 

Hello, 

 

I new still new to APEX and have a class that generates some JSON, but can't figure out how to write a test class for it... I have written test classes before, but not for a page controller that just serves up JSON... 

 

Thanks!

 

public class Json_Controller {
    
    public string json {get;set;}
        
    public Json_Controller() {      
        VQ_Reference_Sheet__c[] vqr = new VQ_Reference_Sheet__c[]{};
        integer start = 0;
        integer pageSize = 100;
        
        if (ApexPages.currentPage().getParameters().get('start') != null && ApexPages.currentPage().getParameters().get('limit') != null) {
            start = integer.valueof(ApexPages.currentPage().getParameters().get('start'));
            pageSize = integer.valueof(ApexPages.currentPage().getParameters().get('limit'));
        }
        
        string jsonRecordsString = '';
        
        integer i = 1;
        integer j = 0;
        
        for (VQ_Reference_Sheet__c v : [Select 
        
        id, 
        name, 
        Times_Referenced_Used_Total__c, 
        Hardware_Platform__c
              
        
        from VQ_Reference_Sheet__c order by name limit 1000]) {
            if (j >= start) {
                if (i <= pageSize) {
                    jsonRecordsString += '{';
                //record info      
                    jsonRecordsString += '"label":' + '"'+v.name+'",';  
                    jsonRecordsString += '"use":' + '["'+v.Times_Referenced_Used_Total__c+'"],';
                    jsonRecordsString += '"hrd":' + '["'+v.Hardware_Platform__c+'"],';
                    
                //record id    
                    jsonRecordsString += '"sfdcid":' + '"'+v.id+'",';
                    jsonRecordsString += '},';
                    i++;
                }
            }
            vqr.add(v);
            j++;
        }
        
      //lets do some clean-up   
            jsonRecordsString = jsonRecordsString.replaceAll(' 00:00:00','');
            jsonRecordsString = jsonRecordsString.replaceAll(';','","');
            jsonRecordsString = jsonRecordsString.replaceAll('null','');
            jsonRecordsString = jsonRecordsString.replaceAll('"latlng":","','"latlng":""');
               
        string jsonString = 'sfdccallback({ types: {"Reference" : {pluralLabel: "References"}},"items":[' + jsonRecordsString + '], "properties" : {"rev" : {"valueType" : "number"}, "emp" : {"valueType" : "number"}}   })';
        jsonString = jsonString.replaceAll(',]',']');
        this.json = jsonString;

    }
}

 

I have started something like this just to see if I can get it to  work, but still not success: 

@isTest
private class ControllerTest {
    static testMethod void Json_Controller() {
        Json_Controller controller = new Json_Controller();
        System.assertEquals(json.substring(0, 12),'sfdccallback');
    }
}

 

I have an authenticated site where some users can switch the account which drives the data displayed on the site. The account could be either the one tied to the portal users account (the one the contact record is tied to) or another account which is a child account (though the parent account hierarchy).

 

Users can submit a record which essentailly just updates a date on the record. This date triggers an workflow email alert. When the user submits a record tied to "their" account, there is no problem, but when the user submits a record against a different account an Invalid Cross Reference ID error is thrown. The error occurs as the workflow is evaluated. Turning off the email alert results in a successful submission.

 

The workflow email alert does use a visualforce template, but I removed all the markup from that template and no error was thrown.

 

Error log below. Any help at all would be appreciated.

 

16:41:02.646 (1646850000)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01IA0000001wgKG
16:41:02.691 (1691668000)|WF_RULE_EVAL_BEGIN|Assignment
16:41:02.691 (1691690000)|WF_RULE_EVAL_BEGIN|Response
16:41:02.691 (1691699000)|WF_RULE_EVAL_BEGIN|Workflow
16:41:02.691 (1691724000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping - Placed Thank You|01QA00000005Dqb|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.698 (1698456000)|WF_RULE_FILTER|[Shipping Schedule Header : Ordered Date not equal to null]
16:41:02.698 (1698480000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.698 (1698488000)|WF_CRITERIA_END|true
16:41:02.715 (1715916000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping 6 month confirm|01QA00000005Dqc|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.715 (1715985000)|WF_RULE_FILTER|[Shipping Schedule Header : Confirmation Date equals null]
16:41:02.716 (1716005000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.716 (1716014000)|WF_CRITERIA_END|false
16:41:02.716 (1716029000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Place Order reminder|01QA00000005DqZ|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.716 (1716455000)|WF_RULE_NOT_EVALUATED
16:41:02.716 (1716540000)|WF_SPOOL_ACTION_BEGIN|Workflow
16:41:02.716 (1716564000)|WF_RULE_INVOCATION|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]
16:41:02.716 (1716578000)|WF_EMAIL_ALERT|Id=01WA00000008rih|CurrentRule:Portal Shipping - Placed Thank You (Id=01QA00000005Dqb)
16:41:02.809 (1809641000)|WF_ACTION| Email Alert: 1;
16:41:02.809 (1809660000)|WF_RULE_EVAL_BEGIN|Escalation
16:41:02.809 (1809667000)|WF_RULE_EVAL_END
16:41:02.809 (1809675000)|WF_TIME_TRIGGERS_BEGIN
16:41:02.809 (1809751000)|WF_ACTIONS_END| Email Alert: 1;
16:41:02.809 (1809757000)|CODE_UNIT_FINISHED|Workflow:01IA0000001wgKG
16:41:02.809 (1809920000)|DML_END|[258]
16:41:02.810 (1810050000)|EXCEPTION_THROWN|[258]|System.DmlException: Update failed. First exception on row 0 with id a2AA00000000Bn1MAE; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
16

 

Built a controller and an visualforce page. Trying to gather records from an object and then use <apex:repeat> to display them on the page. Here's the controller code:

 

public class MyCustomRentalExtension {
	
	//The standard controller on which this extension is based
	Custom_Rental__c rental;
	
	//Properties of this class
	public String booth {get;set;}
	List<Custom_Rental__c> allSizes = new List<Custom_Rental__c>();
	
	//Constructor
	public MyCustomRentalExtension() {
		//set the default size
		booth = '10x10';
		
		//on page load, get the size param from the URL 
		String sizeParam = ApexPages.currentPage().getParameters().get('booth');
		if (sizeParam != ''){
			for (Custom_Rental__c cr : allSizes){
				if(cr.Booth__c == sizeParam){
					booth = cr.Booth__c;
				}
			}
		}
	}
	
	
	//List records for a specific booth size
	public List<Custom_Rental__c> getBooths() {
		return [Select p.id, p.File_Name__c, p.Preview_Link__c from Custom_Rental__c p where p.Booth__c = :booth Order By p.File_Name__c];
	}
}

Here is the VF Page:

<apex:page showHeader="false" id="body" standardStylesheets="false" controller="MyCustomRentalExtension" cache="true" expires="600">
<head>
<title>{!booth} Customer Rental Extension Site</title></head>

<h2> {!booth} Custom Rental Portfolio</h2><br/>
<p>To learn more about our {!booth} custom rental solutions click on one of the booth photographs below.</p><br/>

<apex:form id="form">
	<apex:outputPanel id="list">
		<apex:repeat value="{!Booths}" var="booth" id="boothList">
			<div style="float: left; padding:0; margin:0px 15px 15px 0px;">
				<h4 align="center">{!booth.File_Name__c}</h4>
				<div style="border: 2px solid #e2e2e2; margin:0; padding:2px;">
					<a href="Page1?id={booth.id}">
						<img src="{!booth.Preview_Link__c}" width="250" height="200" alt="{!booth.Name}" />
						</a>
						</div>
					</div>
				</apex:repeat>
			</apex:outputPanel>
		</apex:form>

</apex:page>

 

 I am getting an error on the VF page saying "Unknown Property 'String.File_Name__c'

I'm trying to modify the code in the awesome Campaign Membership Manager app in order to add a button that updates the status of all selected members to a specific option (which I want to hard code).

 

The existing button allows the user to remove the selected members.

 

I, uh, added the button. But as far as developing the functionality, I'm a dum dum.

 

 

This is my button: 

<apex:commandButton value="Update to Hand Deliver" action="{!updateSelectedStatusMail}" rendered="{!NOT(ISNULL(CampaignMembers))}" />

 

And here's the code:

 

/**
*  CMM Campaign Membership Manager
*  Copyright (c) 2009, Marcel Will, Sales Engineering, Salesforce.com Inc.
*  All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
*  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*  Neither the name of the salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
*  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
*  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
*  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public with sharing class cmmCampaignMembershipManagerController{
    
    private List<myCampaignMember>  campaignMemberList { get; set; }   
    private List<myCampaignMember>  CampaignMembers;            
    private List<myCampaignMember>  pageCampaignMemberList;          
    private List<CampaignMember>    deleteCampaignMembers;      
    private Map<Id, CampaignMember> selectedCampaignMembersMap;
    
    private String  selectedCampaign;
    private String  CampaignDescription;
    private String  userName;
    private String  userLanguage;
    private Integer pageNumber;
    private Integer pageSize;
    private integer totalPageNumber;
    private Integer selectedRows; 
    
    public Boolean selectAllCheckbox        { get; set; }
    public String  messageTitle             { get; set; }
    public String  messageDetail            { get; set; }
    public String  messageSeverity          { get; set; }
    transient public Boolean messageShow    { get; set; }
    
    /**
    * constructor
    */
    public cmmCampaignMembershipManagerController(){
        
        this.CampaignMembers            = new List<myCampaignMember>{};
        this.pageCampaignMemberList     = new List<myCampaignMember>{}; 
        this.deleteCampaignMembers      = new List<CampaignMember>();
        this.selectedCampaignMembersMap = new Map<Id, CampaignMember>();
        
        this.userName       = UserInfo.getUserId();
        this.userLanguage   = UserInfo.getLanguage();
        
        this.pageNumber         = 0;
        this.totalPageNumber    = 0;
        this.selectedRows       = 0;
        this.pageSize           = 10;
    }
    
    /**
    * Getter method to retrieve the user language
    * @return userLanguage
    */
    public String getUserLanguage(){
        return userLanguage.Substring( 0, 2 );
    }
    
    /**
    * Getter Method to retrieve the current page number
    * @return pageNumber
    */
    public Integer getPageNumber(){
        return pageNumber;
    }
    
    /**
    * Getter method to retrieve the page size
    * @return pageSize
    */
    public Integer getPageSize(){
        return pageSize;
    }
    
    /**
    * Getter method to enable previous button
    * @return Boolean
    */
    public Boolean getPreviousButtonEnabled(){
        return !( pageNumber > 1 );
    }
    
    /**
    * Getter method to enable Next button
    * @return Boolean
    */
    public Boolean getNextButtonEnabled(){
        if( campaignMemberList == null ){
            return true;
        }else{
            return ( ( pageNumber * pageSize ) >= campaignMemberList.size() );
        }
    }
    
    /**
    * Getter method to retrieve total page number
    * @return totalPageNumber
    */
    public Integer getTotalPageNumber(){
        
        totalPageNumber = campaignMemberList.size() / pageSize;
        Integer mod     = campaignMemberList.size() - ( totalPageNumber * pageSize );
        
        if( mod > 0 ){
            totalPageNumber++;
        }
        
        return totalPageNumber;
    }
    
    /**
    * Getter method to retrieve Campaign member list
    * @return List<myCampaignMember>
    */
    public List<myCampaignMember> getCampaignMembers(){
        
        if( pageCampaignMemberList.Size() > 0 ){
            return pageCampaignMemberList;
        }else{
            return null;
        }
    }   
    
    /**
    * Getter to retrieve the number of selected rows
    * @return selectedRows
    */
    public Integer getSelectedRows(){
        return this.selectedRows;
    }
    
    /**
    * Recalculate Number of selected items in Grid
    * @return null
    */
    public Integer recalculateSelected(){
        selectedRows = selectedCampaignMembersMap.size();
        return null;
    }
    
    /**
    * Bind data to paged list for displaying on VF page
    * @param newPageIndex
    */
    private void BindData( Integer newPageIndex ){
        
        try{

            Transient Integer counter   = 0;
            Transient Integer min       = 0;
            Transient Integer max       = 0;
            
            if( newPageIndex > PageNumber ){
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }else{
                max = newPageIndex * pageSize;
                min = max - pageSize;
            }
            
            CampaignMembers.clear();
            pageCampaignMemberList.clear();
            
            for( myCampaignMember cm: CampaignMemberList ){
                counter++;
                if( counter > min && counter <= max ){
                    pageCampaignMemberList.add( cm );
                }
            }
            pageNumber = newPageIndex;
            if( pageCampaignMemberList == null || pageCampaignMemberList.size() <= 0 ){
                messageTitle        = 'CMM_No_data';
                messageDetail       = 'CMM_No_data_available';
                messageSeverity     = 'info';
                messageShow         = true;
            }
        }catch( Exception ex ){
            messageTitle    = ex.getMessage();
            messageDetail   = ex.getMessage();
            messageSeverity = 'fatal';
            messageShow     = true;
        }
    }
    
    /**
    * Search for all Campaign Members of a selected campaign and put them into a list of <myCamapaignMember>
    * @return PageReference
    */
    public PageReference DoSearch(){
        
        this.campaignMemberList = new List<myCampaignMember>();
        this.pageCampaignMemberList.clear();
        
        for( CampaignMember cm: [ Select Id, LeadId, Lead.Company, Lead.Email, Lead.FirstName, Lead.LastName, Lead.OwnerId, Lead.City, ContactId, 
                                    Contact.Account.Name, Contact.Email, Contact.FirstName, Contact.LastName, Contact.OwnerId, Contact.MailingCity, Status 
                                    from CampaignMember 
                                    WHERE CampaignId =: selectedCampaign AND ( Contact.OwnerID =: userName OR Lead.OwnerID =: userName ) 
                                    ORDER BY Lead.LastName, Contact.LastName ] ){
                                        
            this.campaignMemberList.add( new MyCampaignMember( cm ) );
        }
        
        this.BindData( 1 );
        this.selectedRows = 0;
        
        return null;
    }   
    
    /**
    * Action method on next button
    * @return PageReference
    */
    public PageReference nextBtnClick(){
        
        clearMessage();
        updateSelectedList();       
        BindData( pageNumber + 1 );
        
        return null;
    }
    
    /**
    * Action method on previous button
    * @return PageReference
    */
    public PageReference previousBtnClick(){
        
        clearMessage();
        updateSelectedList();       
        BindData( pageNumber -1 );
        
        return null;
    }
    
    /**
    * This method clears the message on the visual force page.
    * @return PageReference
    */
    public pageReference clearMessage(){
        this.messageShow = false;
        return null;
    }
    
    /**
    * Get Campaign Description for selected Campaign to show on VF page     
    * @return CampaignDescription
    */                
    public String getCampaignDescription(){
        
        CampaignDescription = 'CMM_Select_Campaign';
        
        if( selectedCampaign != null ){
            Campaign myCampaign = [ select id, description from Campaign where id =: selectedCampaign ];
            CampaignDescription = myCampaign.Description;
        }
        
        return CampaignDescription;
    }

    /**
    * Update list of selected records for processing 
    */ 
    public void updateSelectedList(){
        List<myCampaignMember> members = this.getCampaignMembers();
        if( members != null ){
            for( myCampaignMember mcMember : getCampaignMembers() ){
                if( mcMember.selected == true ){
                    selectedCampaignMembersMap.put( mcMember.campmem.id, mcMember.campmem );
                }else{
                    selectedCampaignMembersMap.remove( mcMember.campmem.id );
                }
            }
            
            selectedRows = selectedCampaignMembersMap.size();
        }
    }

    /**
    * Delete selected campaign members
    * @return PageReference
    */
    public PageReference updateSelectedStatusMail(){
        
        updateSelectedList();
        deleteCampaignMembers.clear();
        deleteCampaignMembers = selectedCampaignMembersMap.values();
        
        try{
            if( deleteCampaignMembers.size() > 0 ){
                delete deleteCampaignMembers;
                messageTitle    = 'CMM_Successful';
                messageDetail   = deleteCampaignMembers.size() + ' ' + 'CMM_Successfully_removed';
                messageSeverity = 'confirm';
                messageShow = true;
            }
            else{
                messageTitle    = 'CMM_Error';
                messageDetail   = 'Please select at least one member';
                messageSeverity = 'fatal';
                messageShow = true;
            }
        }catch( DmlException e ){
            messageTitle    = 'CMM_Error';
            messageDetail   = e.getMessage();
            messageSeverity = 'fatal';
        }finally{
            messageShow = true;
        }
        
        campaignMemberList.clear();
        selectedCampaignMembersMap.clear();
        selectedRows = 0;
        DoSearch(); 
        
        return null;
    }
    
    
        /**
    * Update Status of Campaign Members to 'Hand Deliver'
    * Customization added October 18, 2011
    * @return PageReference
    */
    public PageReference processSelected(){
        
        updateSelectedList();

        
        campaignMemberList.clear();
        selectedCampaignMembersMap.clear();
        selectedRows = 0;
        DoSearch(); 
        
        return null;
    }

    /**
    * Get list of all Campaigns with Status equals to "Planned" and with Active equals to "true"
    * @return List<SelectOption>
    */
    public List<SelectOption> getCampaigns(){
        
        List<SelectOption> options  = new List<SelectOption>();
        List<Campaign> cList        = new List<Campaign>();
        
        try {
            cList = [ SELECT Id, Name, Description FROM Campaign WHERE Status = 'Planned' AND IsActive = true ORDER BY Name ];
            for( Campaign c: cList ){
                options.add( new SelectOption( c.Id, c.Name ) );
            }
            
            if( cList == null || cList.size() <= 0 ){
                // Show Info Message that no records have been found
                messageTitle    = 'CMM_No_data';
                messageDetail   = 'CMM_No_Campaign';
                messageSeverity = 'info';
                messageShow     = true;
                
                return null;    
            }else{
                return options;
            }        
        }catch( Exception ex ){
           // Show error Message with severity FATAL
           // messageTitle  = 'CMM_Error';
           // messageDetail     = ex.getMessage();
           //messageSeverity = 'fatal';
           //messageShow    = true;
           return null;
        } 
    }
    
    /**
    * Getter method to retreieve the selected campaing
    * @return selectedCampaign
    */
    public String getSelectedCampaign(){
        return this.selectedCampaign;
    }
    
    /**
    * Setter method to set te selected Campaign
    * @param selectedCampaign
    */
    public void setSelectedCampaign( String selectedCampaign ){
        this.selectedCampaign = selectedCampaign;
    }     
    
    /**
    * Inner Class 
    * myCampaignMember to extend CampaignMember object with selected field (checkbox, boolean)
    */
    public class myCampaignMember{
        
        public CampaignMember campmem   { get; set; }
        public Boolean selected         { get; set; }
        
        /**
        * Constructor
        */
        public myCampaignMember( CampaignMember cm ){
            this.campmem    = cm;
            this.selected   = false;
        }
    } 
}

 

We have a pretty typical Sites login page for a Customer Portal.  We are finding that if the user logs in successfully, closes just that one browser tab, opens a new tab, and then attempts to login again, they get one of those generic "An error has occurred loading a Visualforce page" errors.  If the user logs out first, or closes the browser entirely, they can login fine. 

 

Seems like something to do with the session cookie but not sure not to work around it.  Any suggestions?

We have a solution that includes a custom object hanging off of Leads.  We have built a trigger that uses an "after update" action to populate an Opportunity lookup on that field when the lead is converted.  It basically check to see if the Lead "IsConverted", then grabs the "ConvertedOpportunityId" to populate the lookup on this custom object.

 

This has worked fine for months until yesterday when we introduced a time dependent WF rule on that custom object.

 

Now when we convert leads, we get this error.  It references our WF rule, but then also has a bunch of jibberish that I do not understand.  Here is the error.

 

Error: System.DmlException: Update failed. First exception on row 0 with id 00Q4000000ZAxfHEAT; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0H40000002rHJZEA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, The formula in the "Auto NDA DDP to DocuSign" rule or process is invalid due to the following:
java.sql.SQLException: ORA-20025: ORA-06512: at "SNEEZY.SACCESS", line 1237 ORA-06512: at "SNEEZY.CACCESS", line 2133 ORA-06512: at "SNEEZY.CACCESS", line 2064 ORA-06512: at line 1 : SQLException while executing plsql statement: {call cAccess.check_entity_access_ncu(?,?,?,?,?,?)}(common.request.SqlUserInfo@8f11af, common.request.SqlBtSettingsInfo@19ccfdf, 00Q4000000ZAxfH, 1, true, false): [] Trigger.LeadTrigger: line 104, column 9: [] (System Code) External entry point

 

Does anyone have a clue what is causing this?  And FYI, line 104 in the trigger is the update statement for the custom object after we have populated the Opportunity lookup.

 

And what the heck is SNEEZY??

 

Thanks.

Hi,

I am encountering strange problem again. I have a csv file which has around 100 older leads, some of them are 2008,2009 also. When I upload through data loader the leads whose created date is less than 2011 is loaded perfectly, but 2011 leads are not. Those leads have strange created date values like - 11/7/2011 is loaded as 19/4/2011. The time zone setting in data loader, salesforce setup is correctly set.

 

Whats wrong?

I am attempting to force creation of an opportunity on lead conversion of leads. I've attempted a trigger, but nothing I've tried so far seems to be working. This is what I've got so far:

 

trigger opptyCreationonConvert on Lead (before update) {     

List<Opportunity> o = new List<Opportunity>();
       for(Lead convertedLead: Trigger.new){

if(convertedLead.RecordTypeID == '012T00000000drN'&& convertedLead.IsConverted == TRUE && convertedLead.ConvertedOpportunityId == NULL){               

o.add (new Opportunity(

Name = convertedLead.Company,

CloseDate = date.today()+90,

StageName = '1 - Qualification'));

}

}

insert o;

}

I am trying to create a Mass Edit page where our reps can see certain fields on all of the opportunities they are involved in.  I have the page rendered with all of the records and am attempting to implement a save button that will only update those records which have actually been changed.  Currently, using even the standard controller save functionality, ALL records are modified, but we don't want it to look like a rep changed ALL his records when, in fact, only a few records may have been updated. 

 

Here is what I have right now, but opportunityList is reflecting no changes, so nothing gets updated:

 

public PageReference save() {
	List<Opportunity> updateList = new List<Opportunity>(); //to capture the opportunities that need to be updated
	for (Integer i=0; i < opportunityList.size();i++){ //loop through the opportunities and if anything has been changed, we will update it.
		if(opportunityList.get(i).opp <> originalOpportunityList.get(i).opp){
			updateList.add(opportunityList.get(i).opp);
		}
	}
	update updateList;
	originalOpportunityList = opportunityList;
	return null;
}

 

I belive I need to access the current page values and do some sort of comparison, but I am unsure exactly how to do that.  Any help would be greatly appreciated.

 

Thank you!