• TRossi
  • NEWBIE
  • 5 Points
  • Member since 2011

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

Hello,

I'm very new to salesforce, so hopefully this will be very easy. I would like to update the value of the "Status" of  CampaignMembers from the Lead detail page (thus I want to add a section with a visualforce page in the Lead pagelayout).

 

So far I've developed this extension for the Lead StdController (it loads the Campaign Members which correspond to the lead I am visualizing in the page). As you see I'm missing to overwrite the save() function, because i can't figure out how to get the edited values from the page.

public class CMintoLeadExtension {

    private final Lead lead;
    private final List<CampaignMember> cmlist;    
   
    public CMintoLeadExtension(ApexPages.StandardController stdController) {
        this.lead = (Lead)stdController.getRecord();
        this.cmlist = getCampaignmembers();        
    }

    public List<CampaignMember> getCampaignmembers() {
        List<CampaignMember> CM = [SELECT id,Campaign.Name,Lead.Name,Status FROM CampaignMember WHERE LeadId =:lead.id];
        return CM;
    }
   
    public PageReference save() {
        //prendere la lista editata dalla pagina e lanciarla sul DB
         
        Database.update(cmlist);
        return null;

    }
}

 Then I have this visualforce page, which enables the inLine editing:

<apex:page standardController="Lead" extensions="CMintoLeadExtension"> 

     <apex:form >
         <apex:pageBlock mode="inlineEdit">
         <apex:pageBlockTable value="{!campaignmembers}" var="o">    
            <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>    
            <apex:column value="{!o.Campaign.name}"/>
            <apex:column value="{!o.Lead.Name}"/>
            <apex:column value="{!o.Status}"/>
         </apex:pageBlockTable>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
            </apex:pageBlockButtons>
         </apex:pageBlock >
     </apex:form>
    
</apex:page>

 The page displays fine, I can see the Campaign Members which are in a relationship with the current Lead, but of course the "Save" button doesn't work.

 

Could you please help me? I sense it should not be difficult, it's just a form:) I need to get the values from the form, in my mind the save function in the extension should be:

 

save(){

    take the modified set from the form;

    update the modified set;

}

 

it would be nice to update only the values that are different, but also taking the whole bunch of values and updating will do.

 

Thanks for you help! Any advice is welcome.

Thomas

    

  • November 10, 2011
  • Like
  • 0

Hello All,

 

I am followed the instructions of the Salesforce Touch Platform book that was handed out at Dreamforce in order to create a hybrid android application.

When I am import the ContactExplorer project eclipse complaint that SalesforceDroidGapActivity cannot be resolved. So I added salesforcesdk to my build path. However I am getting different errors:

 

- for Salesforcesdk ==> type org.apache.cordova.DroidDap cannot be resolved. In order to solve this I added cordova-1.8.1..Then I got following error message: R cannot be resolved to a variable    SalesforceRImpl.java    /ContactExplorer/src/com/salesforce/samples/contactexplorer    line 43    Java Problem.

 

Can anybody help?

 

Thanks

Ismail

 

 I tried with mod(integer,integer) and  integer %10 but errors are thrown

what can i do to get remainder when division operation is performed

  • December 21, 2010
  • Like
  • 0