• David Roberts 4
  • 154 Points
  • Member since 2015
  • Business Development manager
  • Logicom Virtual Worlds

  • Chatter
  • 0
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 16
  • 215
I have system.debug statements at the start of and throughout my method and they all report as expected.
I create a new list of a wrapper class. .
When I add a newly created wrapper object to the list, it causes any debug statements before the call to disappear.
Any suggestions?
I can create a file using:
String strDebug = 'some debug information \n';
        //SELECT title,  LatestPublishedVersionId FROM ContentDocument where title = 'debuglog.txt'
        ContentVersion file = new ContentVersion(
            title = 'debuglog.txt',
            versionData = Blob.valueOf( strDebug ),
            pathOnClient = '/debuglog.txt'
        insert file;

but how do I overwrite it (add a new version) so I don't get multiple 'debuglog.txt' files?
Is there a 'Who' lookup or do I need to have both a Contact and a User field with a check that only one of these is used?
What, if any, are the pitfalls?
A Trailblazer Community posting (https://success.salesforce.com/_ui/core/userprofile/UserProfilePage?u=00530000001sMqZ&tab=sfdc.ProfilePlatformFeed&fId=0D53A00004Y1vM9&s1oid=00D300000000iTz&emkind=chatterGroupDigest&s1nid=0DB30000000072L&emtm=1566722973622&s1uid=0053A00000DGqXQ&fromEmail=1&s1ext=0)led me to develop this handy solution for exporting the Country and State codes. Knowledge article 338321  (https://help.salesforce.com/articleView?id=000338321&type=1&mode=1) was the starting point.
Here's the Visualforce Page:
<apex:page controller="ExportToExcelController" readOnly="true" 
    action="{!fetchListOfCountryCodes}" contentType="application/vnd.ms-excel#{!fileName}.xls">
  <!-- https://help.salesforce.com/articleView?id=000338321&type=1&mode=1 -->  
        <apex:repeat value="{!Countries}" var="cos">
        <apex:repeat value="{!States}" var="st">

and the controller:
public class ExportToExcelController {
    public String fileName {get; set;}
    public List<List<String>> Countries {get; set;}
    public List<List<String>> States {get; set;}

    public void fetchListOfCountryCodes() {
        List<Schema.PicklistEntry> ple;
        fileName = 'countryandstatecodes';
        Countries = new List<List<String>>();
        Schema.DescribeFieldResult fieldResult = User.Countrycode.getDescribe();
        ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry f : ple){
            List<String> aCountry = new List<String>();
        	//System.debug(f.getLabel() +'::'+ f.getValue());
        States = new List<List<String>>();
        fieldResult = User.statecode.getDescribe();
        ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry f : ple){
            List<String> aState = new List<String>();
        	//System.debug(f.getLabel() +'::'+ f.getValue());

The "Search in Files" feature is particularly irritating because it doesn't search components.
Also, the debug logs won't show the last few lines without jumping back up the list.
The "Search"  box overlays the horizontal scroll bar.
I'm currently hardcoding an input value into a vf page.
When testing, I want a different value.

<!-- Normal Run-->
<apex:input value="runtime" name="status"/>
<!-- Test-->
<apex:input value="testing" name="status"/>

Does a vf page have the equivalent of the apex isTest() function?

or is there another method of forcing a different value to be used during testing?
I'm using force.com IDE Eclipse to develop apex and Lightning components.
The test results shows a list of classes/components with their code coverage.
Ideally, selecting one shows the lines of code not covered.

However, sometimes I get the message "unable to find the apex source" and a number of dialogues pop up saying that.

What is the correct procedure to resolve this?

​Any pointers greatly appreciated.
I have a custom object for territories holding postcode and manager of that area.
I want to search for a postcode/zip match and update the page with the result.
I'm using a command button to initiate the search.
My search is returning the correct result but not refreshing the other fields.
I guess I'm not using rerender correctly but can't get it to work.
Please help.

Here's the code:

<apex:page controller="TerritoryController" tabstyle="Territory__c">
    <apex:form >
        <apex:pageBlock title="Area Representative Lookup" id="theBlock">

            <apex:pageBlockSection columns="1" id="theSection">

                <apex:outputText value="{!Area}"/>
                <apex:outputText value="{!Name}"/>
                <apex:outputText value="{!Manager}"/>
                <apex:outputText value="{!Postcode}"/>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="search by postcode" for="searchText" />
                    <apex:inputText value="{!searchText}" id="SearchText"/>

            <apex:pageBlockButtons >
                <apex:commandButton action="{!lookup}" value="Lookup"   rerender="theSection"/> 
<!-- rerender="theBlock"  immediate="true" -->

public class TerritoryController {
    // Called by apex page:
    // ...salesforce.com/apex/vwAreaRepLookup
    public List<Territory__c> myTerList;
    public string name;
    public string postcode;
    public string area;
    public string manager;
    public string searchText;
    public TerritoryController() {
        searchText = '';

    public List<Territory__c> getmyTerList() {
        system.debug('in getmyTerList searchText=>'+searchText+'<');
        ApexPages.Message msgErr;
        ApexPages.Message msgInfo;
        String err = 'Hello';
        String info = 'Hi!';
//example error post
//msgErr = new ApexPages.Message(ApexPages.Severity.ERROR, err);

//example info post
//info = 'searchtext=>'+searchText+'<';
//msgInfo = new ApexPages.Message(ApexPages.Severity.INFO, info);

Territory__c[] myTerList = [Select territory__c.area__c, territory__c.postcode__c, territory__c.name, territory__c.territory_manager__c from Territory__c where postcode__c = :searchText ];
        return myTerList; 

    public String getManager() {
        return 'nothing';

    public String getArea() {
        return 'nothing';

    public String getName() {
        return 'nothing';
    public String getPostcode() {
        system.debug('in get postcode');
        return 'nothing';
    public String getSearchText() {
        return 'MK';
    public void setSearchText(String theSearchText) {
        searchText = theSearchText;
    public void lookup() {
        system.debug('in lookup searchText=>'+searchText+'<');
        Territory__c result = [Select territory__c.area__c, territory__c.postcode__c, territory__c.name, territory__c.territory_manager__c from Territory__c where postcode__c = :searchText limit 1];
        name = result.name;
        postcode = result.postcode__c;
        area = result.area__c;
        manager = result.territory_manager__c;
        system.debug('name: '+name);


I have a page that gets criteria including current location using javascript.
I then construct a url with parameters and launch another page using apex redirect to show a map - but it doesn't draw the map.
Yet, when I launch the page directly using the constructed URL, the map appears.
When sandbox laucnches it, a complex URL is displayed.
What is happenning and how can I remedy it?
I have festooned my code with console logs and system logs but can't see why it fails.
Please help.
I struggled to create a simple Lightning Component that I could add to an account page, so thought I'd share my result.
The presentation of the information isn't tidy yet...that's my next learning excercise!
This can also be used as an action via an action button on the page.
It was based on the article

Hope this helps others.

<aura:component controller="accountSummaryController"
    <!-- based on https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action_recordid.htm#components_using_lex_s1_config_action_recordid -->

     <aura:attribute name="account" type="Account" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <!-- Display details about the account -->
    <div class="slds-page-header" role="banner">
        <p class="slds-text-heading--label">{!v.account.Name}</p>
    <!-- Display the details form needs work -->
    <div class="slds-form--stacked">
    <div class="slds-form-element">       
        <p class="slds-text-heading--label">{!v.account.BillingCity}</p>
        <div class="slds-form-element">    
        <p class="slds-text-heading--label">{!v.account.BillingState}</p>
    <div class="slds-form-element"> 
        <p class="slds-text-heading--label">{!v.account.Website}</p>



    doInit : function(component, event, helper) {

        // Prepare the action to load account record
        var action = component.get("c.getAccount");
        action.setParams({"accountId": component.get("v.recordId")});

        // Configure response handler
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(component.isValid() && state === "SUCCESS") {
                component.set("v.account", response.getReturnValue());
            } else {
                console.log('Problem getting account, response state: ' + state);

...and the controller class

public with sharing class accountSummaryController {

    public static Account getAccount(Id accountId) {
        // Perform isAccessible() checks here
        return [SELECT Name, BillingCity, BillingState,website FROM Account WHERE Id = :accountId];
Could someone explain the query syntax in
which uses
results = (List<Account>)[FIND :searchText RETURNING account(Name, billingpostalcode, Phone)][0];
For a start, I don't know what the [0] is doing.
Also, what are search criteria. It isn't returning every account I'd expect.

An alternative would be:
        results = [SELECT  Name, Phone, billingpostalcode FROM Account where name like :searchText];
although I'd add a '%' to the search text.

Hope someone can explain.
I've been trying to add the attendees as a related list on my custom controlled apex page but can't find a syntax that works.
I get errors like: "'EventRelations' is not a valid child relationship name for entity Event "

<apex:relatedList subject="{!anEvent}" list="EventRelations">
        <apex:facet name="header">Attendees</apex:facet>

where "anEvent" is my event record (public Event in controller) which succesfully returns all the fields of the event in a pageBlock.

​Any ideas?
I'm trying to "Build a mapping application for iPhone" following the instructions at
but, as far as I'm concerned, there are some missing instructions.
I'm new to this so, although it may seem obvious, I just don't know how to make it work.

There are two parts that don't make sense to me and I'd be grateful for any assistance.

I'm not sure what to do with the
"The following markup defines the iuivf page used as the template:"
Where do I save the code and as what?

Similarly, what do I do with
" Visualforce page that displays the phone number and rating of the account the user selected from the list view."
What do I call it? Is this the main page that is called to make this work?

Many thanks, Dave.

I'm having great difficulty assigning and testing account ids that I've created in a custom object.

I want to compare accounts
if (thisAc == thatAc){
} //endif

and tried
if (thisAc.id == thatAc.id){
​} //endif

My custom object has an account field: MyCustomObject__c has referenceCompany__c
I can't seem to copy it to another custom object - even a temporary Account

starting from MyCustomObject my1...

MyOtherCustomObject myOco = new(MyOtherCustomObject);
myOco.copiedCompany__c = my1.referenceCompany__c;

I've tried:
Account thisAc = .my1.referenceCompany__c;
Account thatAc= .my1.referenceCompany__r; (which seems close to the answer).

Any suggestions?

Thanks in advance.

I am trying to achieve the following:
I have accounts:
There is a custom object “Licence” consisting of:
Licence holder (an account e.g. RetailerY) with other licence details.
An account may have multiple licences.
I have a custom object “Retailer of” consisting of:
Manufacturer (account)
Retailer (account)
For example;
RetailerX is a retailer of ManufacturerA
RetailerY is a retailer of ManufacturerA
I want to report the licence data of retailers of a manufacturer.
Manufacturer: ManufacturerA:
               Retailer: RetailerX
                              Licence 001 …other details
   Licence 005 …other details
               Retailer: RetailerY
                              Licence 8097 …other details
                              Licence 8098 …other details
                              Licence 8099 …other details
                              Licence 8100 …other details

I have tried joined reports but haven't found a way to achieve it.
Please can anyone tell me how?
(I'm assuming I have structured the data in the only way possible using custom objects).

Does it require a VisualForce page?

Any suggestions and examples would be much appreciated.

The following code throws an exeption at the callout request
CALLOUT_REQUEST [35]|System.HttpRequest[Endpoint=http//:www.virtualworlds.co.uk/getParams.php, Method=POST]
and genearates the error,
"no protocol: http//:www.virtualworlds.co.uk/getParams.php".

I generate the list from custom objects and have verified that the list has entries.

Can you tell me what is wrong?


public class HelloWorld {
    public static void tryPost() {

     System.debug( 'Posting...' );
        List<licence__c> myList = new List<licence__c>();
        myList= [select Id,Name from licence__c LIMIT 20];  
        String endPoint = 'http//:www.virtualworlds.co.uk/getParams.php';
        String method = 'POST';
        //Prepare http req
        System.debug( 'New Request...' );
        HttpRequest req = new HttpRequest();
        System.debug( 'Set endpoint...' );
        String JSONString = JSON.serialize(myList);  
        System.debug( 'new Http...' );
        Http http = new Http();
        System.debug( 'Send request...' );
        HTTPResponse res = http.send(req);
        System.debug( 'Result?...' );

The "Search in Files" feature is particularly irritating because it doesn't search components.
Also, the debug logs won't show the last few lines without jumping back up the list.
The "Search"  box overlays the horizontal scroll bar.
I have system.debug statements at the start of and throughout my method and they all report as expected.
I create a new list of a wrapper class. .
When I add a newly created wrapper object to the list, it causes any debug statements before the call to disappear.
Any suggestions?
Hello All,

I have a situation where aura:iteration is running inside tbody of table to generate dynamic rows. Inside this row, I have a lightning:buttonIcon which has the aura id which is nothing but an attribute. When I do onclick of this buttonIcon which calls my controller method. When i try to fetch the aura id value it returns the attribute as it is instead the value.. Here's my example
     <aura:iteration items="{!v.myList}" var="obj">
                 <lightning:buttonIcon aura:id="{!obj.Sequence}" iconName="utility:add" onclick="{!c.addRow}" size="x-small"/>
addRow : function (component,event,helper){
      var a = event.getSource().getLocalId();
      console.log('a '+a); //THIS RETURNS --> a {!obj.Sequence} 

I am using <lightning:inputField /> for creating input field in component,I want make input is required or mandatory in lightning component.

Please provide sample code or solution around above senario.

I have a working dynamic picklist, but I want it to select multiple options. Help me to do it, please..
Here's me code:

Lightning Component

<aura:attribute name="options" type="String[]" description="options" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="newOpp" type="Opportunity" default="{'sobjectype': 'Opportunity',
                                                           'Name': '',
                                                           'CloseDate': '',
                                                           'Amount': '',
                                                           'StageName': '',
                                                           'Donate_to__c': ''}"/>
<lightning:combobox aura:id="MultiSelect"
							label="Donate to"
							placeholder="Select 1 or more options"
							messageWhenValueMissing="Hey! Don't forget me!"/>

JavaScript Controller

doInit : function(component, event, helper) {
        var action = component.get("c.getDonateTo");
        var input = component.find("MultiSelect");
        var opts=[];
        action.setCallback(this, function(a) {
            for(var i=0;i< a.getReturnValue().length;i++){
                opts.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
            input.set("v.options", opts);
Controller class
public static List<String> getDonateTo(){
  List<String> options = new List<String>();
  Schema.DescribeFieldResult fieldResult = Opportunity.Donate_to__c.getDescribe();
  List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
      for (Schema.PicklistEntry f: ple) {
      return options;
I am very new to lightning, my requirement is in account related contact list I have a custom button(Edit/clone) when we click on this button we need to go custom lightning page. In that custom lightning page, we need to Edit/clone Account related contacts.

please Help in this.
Thanks in advance.
It appears that 'most' of the options available for customizing page layout, only affects the 'edit' page layout and not the 'new' record page layout.
I am looking at customizing page layout while creating 'new' record.

I want to have some field as 'read only' and some fields not visible in new record page layout (just like formula field)
a. Do I have to go with creating new VF page?
b. Is there any other way in Salesforce?

Need Help
I am getting this error: The number of results does not match the number of interviews that were executed in a single bulk execution request.
Here is the apex class I am using, I want to store list<string> data from a json file into a flow variable:
global class par{

    global static List<string> l = new list<string>();
@InvocableMethod(label='Get Map' description='Returns the values of Maps')
    global static List<String> CallMap(){
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HTTPResponse res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken()!= null)
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME))
                    string fieldName = parser.getText();
                if(fieldName == 'place_id')
                    string place = parser.getText();
                }else if(fieldName == 'status')
                    string status = parser.getText();
        return l;




Lets say we have an object and on the lightning component we are displaying its details. when ever i click on the button i need to pass record id to the controller.

This how my code look like:-
<aura:iteration items="{! v.vegs}" var="veg">
            <div class='tile' aura:id="test1" press="{! c.tester}" >              
                <img src='{! veg.Image__c}'  onClick="{! c.tester}" aura:id="imgId" value="{! veg.Name }"> </img>
                Name: {! veg.Name } <br></br>             
                price: {! veg.Price__c }   <br></br>
                <ui:button label="Add to cart" press="{! c.addToCart}"  aura:id="btn1" >      </ui:button>               

I want something similer to :-
<aura:iteration items="{!v.newCases}" var="case">
<button type="button" onclick="{!c.showCaseDeleteModal(case.Id)}">Delete</button>

How can I pass the id to a component controller when the  button gets clicked?

Thank you!
Hi all, 

I have a problem with this challenge :

Create a Queueable Apex class that inserts the same Contact for each Account for a specific state. Write unit tests that achieve 100% code coverage for the class.
Create an Apex class called 'AddPrimaryContact' that implements the Queueable interface.
Create a constructor for the class that accepts as its first argument a Contact sObject and a second argument as a string for the State abbreviation.
The execute method must query for a maximum of 200 Accounts with the BillingState specified by the State abbreviation passed into the constructor and insert the Contact sObject record associated to each Account. Look at the sObject clone() method.
Create an Apex test class called 'AddPrimaryContactTest'.
In the test class, insert 50 Account records for BillingState "NY" and 50 Account records for BillingState "CA". Create an instance of the AddPrimaryContact class, enqueue the job and assert that a Contact record was inserted for each of the 50 Accounts with the BillingState of "CA".
The unit tests must cover all lines of code included in the AddPrimaryContact class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I haven't 100% for my test class. 
 public class AddPrimaryContactTest {
     @isTest static void TestList(){
         List<Account> Teste = new List <Account>();
         for(Integer i=0;i<50;i++){
             Teste.add(new Account(BillingState = 'CA', name = 'Test'+i));
             for(Integer j=0;j<50;j++){
             Teste.add(new Account(BillingState = 'NY', name = 'Test'+j));
         insert Teste;
         Contact co = new Contact();
          String state = 'CA';
     AddPrimaryContact apc = new AddPrimaryContact(co, state);
         for (Account t:Teste){
             if( t.BillingState == 'CA'){
             	System.assertEquals(1, t.Number_of_contacts__c);
public class AddPrimaryContact implements Queueable{
    private Contact c;
    private String state;
    public  AddPrimaryContact(Contact c, String state){
        this.c = c;
        this.state = state;
     public void execute(QueueableContext context) {
        List<Account> ListAccount = [SELECT ID, Name FROM ACCOUNT WHERE BillingState = :state LIMIT 200];
         for (Account l:ListAccount){
             for (Contact co:l.Contacts){
                 c = co.clone(false,false,false,false);
                 insert c;


Anyone can help me please?
Hi all,

I have these 3 fields:
SELECT Name, First_Name__c, Last_Name__c FROM Clients__c 

I would like to run a periodical apex process to split the values from Name into First Name and Last Name.

All charachters until 1st space is First Name and everything else is Last Name.

Can anyone please help?


Hi there,


I am getting the following ERROR:

Exception: System.JSONException: Illegal value for primitive

When I try to deserialize the HTTP response from Jive to an object.


JivePersonObject personRecord = (JivePersonObject) System.JSON.deserialize(jiveResponse, JivePersonObject.class);


I have validated the JSON string at http://jsonlint.com/ and it is valid. 


This is not happening for all the response. It is happening for some response and some of them don't have the issue.


I was wondering if anyone have come across this issue before. Not sure what I am doing wrong here. Thanks.



Hey Guys,


I was playing around with DHTMLX Scheduler today and could not get it to render. All I get is a blank page. I checked the JS and CSS References, and everything seems to be in order, The resources are accessed correctly. 

Has anyone attempted this before ?


Here is the code I used.


  <apex:form id="theForm">
     <apex:includeScript value="{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/codebase/dhtmlxscheduler.js')}"  />
     <apex:stylesheet value="{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/codebase/dhtmlxscheduler.css')}"/>
    <script type="text/javascript" charset="utf-8">
	function initz() {
		scheduler.config.multi_day = true;
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.init('scheduler_here',new Date(2010,0,10),"week");
		scheduler.load("{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/samples/01_initialization_loading/data/events.xml')}");
<body onload="initz();">
	<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
		<div class="dhx_cal_header">
		<div class="dhx_cal_data">

 Many Thanks in advance.



I want to use record Type to limit trigger action. 


Now I use querey to get it my code liks below

string Id = [SELECT id from RecordType where Name ='Someone'].Id;


I also found this page, we could use method to get the Record Type Id to avoid the query.

I still can't understand it.


Is there some simple and easy wayt to get the ID only by Record Type's Name?

Hi folks,


Is there any way I can convert the body of an inbound email from html to Plain Text? I've set up a service to email directly into chatter, but html emails sent from my organisation into Chatter are all of over 1,000 characters in length (even if I send a blank email). So, I'm looking for a way to strip the body text from the emails and discard all the html "nonsense", rather than force users to send emails in Plain Text format, which they'll be disinclined to do.


Any help anyone can give would be massively appreciated.




Hi Pals,


Is it possible to parse/process file uploaded( for e.g. a .csv file) in apex and and fetch records? From what I know, when a file is uploaded from suppose a VF page, we will receive a Blob of that file. But there is no mechanism as such to parse that Blob and see what data is exactly is inside it. I know this I/O processing can be easily done in .Net/Java. But usually a .Net/Java solutions is not what a customer expects because of the extra hosting/costing/whatever the other reasons. So, I want to know if this possible in Apex at all ? I searched boards and also IdeaExchange but did not find any confident answer. Any help is very much appreciated.




Hi All,

I am facing this issue.

Anyone have any idea how to solve this.

public void SaveChanges()
List<Account> AccountList = [Select Id, Name,(Select Id From Contacts) From Account where Id=:this.AccountId];

if(AccountList.size() > 0)
Account UpdateAccount = AccountList[0];
UpdateAccount.Name = this.Name;
UpdateAccount.AccountNumber = this.AccountNumber;
update UpdateAccount;

if(AccountList[0].Contacts.size() > 0)
Contact UserContact = AccountList[0].Contacts[0];
UserContact.FirstName = this.FirstName;
UserContact.LastName = this.LastName;
UserContact.Email = this.PersonalEmailId;
update UserContact;
Contact UserContact = new CanGeneral__c(AccountId = AccountList[0].Id,FirstName = this.FirstName,
LastName = this.LastName, Email = this.PersonalEmailId);
insert UserContact;

hi I have a ApexScheduler Class which need to be test inorder to
deploy can anybody suggest me the way to achieve it to get the
coverage. I am posting the code below


global class ScheduleTerritoryInactiveMemberCheck implements 
Schedulable { 
    global void execute(SchedulableContext SC) { 
        TerritoryInactiveMemberCheck bcc = new 
          bcc.query = 'select id,name from territory'; 




  • December 03, 2010
  • Like
  • 0
Hello all !!

I have to do a find and replace a string on a variable (string). I know there is a matcher object but I couldnt find much documentation on the usage. Any one else used this object ? or is there any other simple function to get this done. Pls help


Message Edited by Raghu_dev on 05-14-2008 05:45 PM
I want to displqy events field on email template. so plz help me or suggest what can i do to print any of field may be standard or custom in email template

I use a controller to display a list of products with a checkbox against each product value . When the end user selects few products and clicks "add quantity" button it should navigate to another VF page in which i should display the selected products and an input filed for quantity. Quite similiar to the way of adding products in opportunity. In the code below im using a single controller for 2 VF pages. Problem i m facing here is when the second page is called the wrapperList becomes null instead of holding the values of the selected products. Please give me some suggestions.


public with sharing class productAdd
    public  List<Product2> Stdproduct{get;set;}
    public List<wrapper> wrapperList {get;set;}  
    public list<wrapper> SelectedprodList{get;set;}	
    public class wrapper
        public product2 cont{get;set;}
        public Boolean selected{get;set;}
        public integer quantity{get;set;}
        public wrapper(product2 c)
            cont = c;
            selected = false;
	public  List<wrapper> getProdList()
        if((wrapperList == null) || (wrapperList.size() == 0))
            wrapperList = new List<wrapper>();
            Stdproduct = [Select id, Name from product2 limit 2];           
            for(Product2 c :(List<Product2>)Stdproduct)            
                wrapperList.add(new wrapper(c));
        return wrapperList;
    public PageReference AddQuantity()
        PageReference pageRef= new PageReference('/apex/AddQuantity');
        return pageRef;           

    public list<wrapper> getSelectedproducts()
        selectedprodList = new list<wrapper>();      
        for(wrapper cCon:getProdList())
        return selectedprodList;           

<!-- 1st Page -->
<apex:page Controller="productAdd" sidebar="false">
    <table  width="90%">
			<apex:repeat value="{!ProdList}" var="l" >               
				<apex:inputCheckbox value="{!l.selected}"/>
				<td class="fieldname">{!l.cont.name}</td>                       
				<apex:commandButton value="Add Quantity" action="{!AddQuantity}"/>

<!-- 2nd Page -->
<apex:page Controller="productAdd">
	<apex:form >
		<apex:pageBlock > 
			<apex:pageBlockTable value="{!Selectedproducts}" var="c" id="table"> 
				<apex:column value="{!c.cont.Name}" />                
				<apex:column >
				<apex:inputText value="{!c.quantity}"/>