• Juul
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 30
    Replies
Hi,

Can anybody help me with a test class for this trigger? I've asked the author of the trigger to send me the test class, but no response. And I'm not familiar with writing triggers / test classes. I've got it working in my sandbox, but I can't deploy it in my production without a test class.

public class LookupCalculation{
    
    public enum Method {COUNT, SUM, MIN, MAX, AVG}
    
    private string sobjectParent,
                   relationName,
                   formulaParent,
                   sobjectChild,
                   parentfield,
                   fieldChild;
    
    public LookupCalculation(string mysobjectParent, string myrelationName, string myformulaParent,
                             string mysobjectChild, string myparentfield, string myfieldChild){
        sobjectParent = mysobjectParent;
        relationName = myrelationName;
        formulaParent = myformulaParent;
        sobjectChild = mysobjectChild;
        parentfield = myparentfield;
        fieldChild = myfieldChild;
    }
    
    public void Calculate(Method calculation, List<sobject> childList){
        set<Id> parentIdSet = new set<Id>();
        for(sobject sobj : childList)
            parentIdSet.add((Id) sobj.get(parentfield));
        string soqlParent = 'select id, (select ' + fieldChild + ' from ' + relationName + ') from ' + sobjectParent + '';
        List<sobject> parentList = Database.query(soqlParent);
        for(sobject parent : parentList){
            List<sobject> children = parent.getSObjects(relationName);
            if(children == null)
                children = new List<sobject>();
            Decimal counter = (mustSum(calculation))? 0 : null;
            if(calculation == Method.COUNT)
                counter = children.size();
            for(sobject child : children){
                Decimal value = (Decimal) child.get(fieldChild);
                if(mustSum(calculation) && value != null)
                    counter += value;
                else if(calculation == Method.MIN && (counter == null || value < counter))
                    counter = value;
                else if(calculation == Method.MAX && (counter == null || value > counter))
                    counter = value;
            }
            if(calculation == Method.AVG && children.size() > 0)
                counter = counter / children.size();
            parent.put(formulaParent, counter);
        }
        update parentList;
    }
    
    private boolean mustSum(Method calculation){
        return (calculation == Method.SUM || calculation == Method.AVG);
    }
    
}

---------------------------------------------------------------------------------------------

trigger InvoiceLineRollUp on Invoice_Line__c (after insert,after update,after delete,after undelete) {
    
    /*******************TO BE CUSTOMIZED*********************/
    string mysobjectParent = 'Invoice__c',      // Parent sobject API Name
           myrelationName = 'Invoice_Lines__r', // Api name of the relation between parent and child (ends with __r)
           myformulaParent = 'Total__c',        // Api name of the number field that will contain the calculation
           mysobjectChild = 'Invoice_Line__c',  // Child sobject API Name
           myparentfield = 'Parent_Invoice__c', // Api name of the lookup field on chield object
           myfieldChild = 'Amount__c';          // Api name of the child field to roll up
    
    LookupCalculation.Method method = LookupCalculation.Method.SUM; //Selected method: could be COUNT, SUM, MIN, MAX, AVG
    /*******************************************************/
    
    LookupCalculation calculation = new LookupCalculation(mysobjectParent, myrelationName, myformulaParent,
                                                          mysobjectChild, myparentfield, myfieldChild);
    List<sobject> objList = new List<sobject>((List<sobject>) Trigger.new);
    if(Trigger.isDelete)
        objList = Trigger.old;
    if(Trigger.isUpdate)
        objList.addAll((List<sobject>) Trigger.old);
    calculation.calculate(method, objList);
}


See website: http://blog.elieperez.net/salesforce-lookup-roll-up-summary/
  • February 17, 2014
  • Like
  • 1
Hi,

For a client I need to create a simple table with the most important reports of the organisation.
The idea is to create a tabbed visualforce page, so the user can choose between: Accountmanagement, Salesmanagement and Targets

See code:

<apex:page >
    <apex:tabPanel >
        <apex:tab label="Accountmanagement reports">
            <apex:include pageName="NAME OF VF PAGE for accountmanagement"/>
        </apex:tab>
        <apex:tab label="Salesmanagement reports">
            <apex:include pageName="NAME OF VF PAGE for salesmanagement"/>
        </apex:tab>
        <apex:tab label="Salesmanagement targets">
            <apex:include pageName="NAME OF VF PAGE for targets"/>
        </apex:tab>
    </apex:tabPanel>
</apex:page>

For the table I've created a html page with css style. It's probably not the correct way to include css style, but the page is working. 
But when I place this page into the section <apex:include pageName="NAME OF VF PAGE for accountmanagement"/> the complete page  including the tab page is taking over the css style and it's not looking how it supposes to...

This is the code of one of the vf pages:

<apex:page standardstylesheets="false" showheader="false">
<html lang="en">
<head>
  <title>Simple Table</title>
  <script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script type="text/javascript">
$(function() {
/* For zebra striping */
$("table tr:nth-child(odd)").addClass("odd-row");
/* For cell text alignment */
$("table td:first-child, table th:first-child").addClass("first");
/* For removing the last border */
$("table td:last-child, table th:last-child").addClass("last");
});
  </script>
  <style type="text/css">
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
margin:0;
padding:0;
font:12px/15px "Helvetica Neue",Arial, Helvetica, sans-serif;
color: #555;
background:#f5f5f5 url(bg.jpg);
}
a {color:#666;}
#content {width:65%; max-width:690px; margin:6% auto 0;}
/*
Pretty Table Styling
CSS Tricks also has a nice writeup: http://css-tricks.com/feature-table-design/
*/
table {
overflow:hidden;
border:1px solid #d3d3d3;
background:#fefefe;
width:70%;
margin:5% auto 0;
-moz-border-radius:5px; /* FF1+ */
-webkit-border-radius:5px; /* Saf3-4 */
border-radius:5px;
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}
th, td {padding:18px 28px 18px; text-align:center; }
th {padding-top:22px; text-shadow: 1px 1px 1px #fff; background:#e8eaeb;}
td {border-top:1px solid #e0e0e0; border-right:1px solid #e0e0e0;}
tr.odd-row td {background:#f6f6f6;}
td.first, th.first {text-align:left}
td.last {border-right:none;}
/*
Background gradients are completely unnecessary but a neat effect.
*/
td {
background: -moz-linear-gradient(100% 25% 90deg, #fefefe, #f9f9f9);
background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f9f9f9), to(#fefefe));
}
tr.odd-row td {
background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
}
th {
background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
}
/*
I know this is annoying, but we need additional styling so webkit will recognize rounded corners on background elements.
Nice write up of this issue: http://www.onenaught.com/posts/266/css-inner-elements-breaking-border-radius
And, since we've applied the background colors to td/th element because of IE, Gecko browsers also need it.
*/
tr:first-child th.first {
-moz-border-radius-topleft:5px;
-webkit-border-top-left-radius:5px; /* Saf3-4 */
}
tr:first-child th.last {
-moz-border-radius-topright:5px;
-webkit-border-top-right-radius:5px; /* Saf3-4 */
}
tr:last-child td.first {
-moz-border-radius-bottomleft:5px;
-webkit-border-bottom-left-radius:5px; /* Saf3-4 */
}
tr:last-child td.last {
-moz-border-radius-bottomright:5px;
-webkit-border-bottom-right-radius:5px; /* Saf3-4 */
}
  </style>
</head>
<body>
<div style="margin-left: 0px; width: 1166px;" id="content">
<table cellspacing="0">
  <tbody>
    <tr>
      <th style="width: 103px;">Description</th>
      <th style="width: 9px;">Total</th>
      <th style="width: 60px;">Unit 1</th>
      <th style="width: 60px;">Unit 2</th>
      <th style="width: 60px;">Unit 3</th>
      <th style="width: 60px;">Unit 4</th>
      <th style="width: 60px;">Unit 5</th>
      <th style="width: 60px;">Unit 6</th>
      <th style="width: 60px;">Unit 7</th>
      <th style="width: 60px;">Unit 8</th>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
end of contract</td>
      <td style="width: 9px;"><a
href="https://eu3.salesforce.com/000"
target="_blank">Sales</a></td>
      <td style="width: 60px;"><a
href="https://eu3.salesforce.com/000"
target="_blank">Sales</a><br></br>
-
      <span style="font-size: small; font-family: verdana,geneva;"></span><a
href="https://eu3.salesforce.com/000"
target="_blank">Account</a></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Expected
tenders</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Open
opps</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
lost</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
won</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="width: 103px;"><span
style="font-weight: bold;">Dashboard</span></td>
      <td style="width: 9px;"></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>

</apex:page>

 
I probably need to add this line: <apex:stylesheet value="{URLFOR($Resourse.Style_table, 'Style_table.css')}"/> somehow....
Style_table is the css zipfile i've added to static resources.

Can anyone please help me, I'm a very beginner in vf.

thanks!
  • February 07, 2014
  • Like
  • 0

Hi,

 

is it possible to create an opportunity line item tab?

We've created a custom owner field on the opportunity products for our specialty sales departments.

They can't use the list views in opportunities (f.e. my open opportunities, my lost opps etc) so they need one based on opportunity line items. Is this possible?

 

I hope someone can point me in the right direction.

 

Thanks 

  • December 03, 2013
  • Like
  • 0

Hi,

 

I've created a button on my event page that will copy some fields into a new g-mail message.

But when the description field is too long, g-mail will give me an error. 

Is it possible to change the code so g-mail will accept the description field with more than f.e. 1000 characters?

 

javascript&colon;popw='';Q='';x=document;y=window;if(x.selection) {Q=x.selection.createRange().text;} else if (y.getSelection) {Q=y.getSelection();} else if (x.getSelection) {Q=x.getSelection();}popw = y.open('https://mail.google.com/mail?view=cm&tf=0' + escape(document.title) + '&su=Event - at {!Event.Accountname__c} in {!Event.Location} on {!Event.ActivityDate}' + '&to=' + '&body=Dear colleague,'+ escape('\n') + escape('\n') + 'Check out my event summary:'+ escape('\n')+ escape('\n')+ 'Subject: {!Event.Subject}' + escape('\n')+ 'Type event: {!Event.Type_of_event__c}' + escape('\n') + 'Event: {!Event.Event__c}' + escape('\n') + escape('\n') +'{!JSENCODE(Event.Description)} '  ,'gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

 Thanks!

 

Juul

  • October 04, 2013
  • Like
  • 0

Hi,

 

Due to security issues we need to rebuild the contract object in a new custom object.

Is there a posibility to clone the contract object (with all the fields 100+) and records to a new custom object?

 

thanks

 

juul

  • October 04, 2013
  • Like
  • 0

Hi,

 

I want to add the Campaign Member Summary using Google Charts item on my campaign page. But I'm getting an error when saving the test class:

 

unexpected token: 'testMethod' in line 1

 

What do I need to change to get it working?

 

 

static testMethod void testVFController_Sidebar_Summary() {
         
        // Create Campaign
        Campaign c = new Campaign();
        c.Name = 'Test Campaign';
        insert c;
         
        // Create Lead
        Lead l = new Lead();
        l.LastName = 'Last Name';
        l.Company = 'Company';
        insert l;
         
        // Create Campaign Member
        CampaignMember cms = new CampaignMember();
        cms.CampaignId = c.id;
        cms.LeadId = l.id;
        insert cms;
         
        test.startTest();
         
        ApexPages.StandardController sc = new ApexPages.StandardController(c);
        VFController_CampaignMemberStatusChart controller = new VFController_CampaignMemberStatusChart(sc);
        String s1 = controller.getChartData();
         
        test.stopTest();
    }
 
}

 

  • September 08, 2013
  • Like
  • 0

Hi ,

 

What do I need to change to refer to a thank you page after pressing the button "Update"?

 

Class:

 

public class UpdateCampaignMemberClass{

    public final CampaignMember cm;

    private ApexPages.StandardController cmController;

    public UpdateCampaignMemberClass(ApexPages.StandardController controller) {
        cmController = controller;
        this.cm= (CampaignMember)controller.getRecord();
    }

    public PageReference UpdateAction() {
             try{
            update cm;
            }
            catch(DmlException ex){
            ApexPages.addMessages(ex);
            }
       
       return new PageReference('http://test.force.com/web2campaign/?id=' + cm.id );
    }   public string getStatus(string Status){
            return 'Test__c';
            return 'Test_2__c';
   } 
    
      
       
 }

VF:

 

<apex:page standardController="CampaignMember" extensions="UpdateCampaignMemberClass" sidebar="false" showHeader="false">

<script type="text/javascript"> 

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
} } 

function showAlert(variable){
    alert(variable);
    }
</script>

<apex:form >
    <b>Campaign Member ID </b><apex:inputfield value="{!campaignmember.Id}"/><br/><br/>
            Status <apex:inputfield value="{!campaignmember.Test__c}"/><br/><br/>
            Status <apex:inputfield value="{!campaignmember.Test_2__c}"/><br/><br/>
    <apex:commandButton value="Update" action="{!UpdateAction}" />
    
    
    

</apex:form>
</apex:page>

 

 

 

  • September 03, 2013
  • Like
  • 0

Hi,

I've created a visualforce template with help of this app: https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016cYlEAI

When I generate a test (email) with myself as user and a test opportunity everything is working fine. It displays all the product data.
But when the workflow is triggered and I receive a notification email, there is no data visible in the email.

What's going wrong? (sorry for the Dutch text...)

<messaging:emailTemplate recipientType="User"
    relatedToType="Opportunity"
    subject="Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity: {!relatedTo.name}">
    
<messaging:htmlEmailBody >        
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Beste collega,</p>
        <p>Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity:<b> {!relatedTo.name}</b>.</p>
        <p>Controleer voordat je wijzigingen wil doorvoeren of je aan het opportunity team van deze opportunity bent gekoppeld, anders krijg je de foutmelding dat je hier geen rechten voor hebt.</p>
        <p>Mocht je nog niet aan het opportunityteam zijn gekoppeld neem dan contact op met {!relatedTo.owner.name}.</p>
        
        <br/>Account: <i> {!relatedTo.Account.name}  </i>  
        <br/>Opportunity eigenaar: {!relatedTo.owner.name}
        <br/>Opportunity fairshare waarde: {!ROUND(relatedTo.Amount,0)} 
        <br/>Opportunity gunningsdatum: {!relatedTo.CloseDate}  
   
        <p/>                  
       <table border="0" >
                 <tr > 
                     <th>Actie</th><th>Dienstnaam</th><th>Dienst specificatie</th><th>Hoeveelheid</th><th>Verkoopprijs</th><th>Totale fairshare waarde label</th>
                  </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://emea.salesforce.com/{!opp.id}">View</a> |  
           <a href="https://emea.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!opp.Service_specification__c}</td>
           <td>{!ROUND(opp.Quantity,0)}</td>
           <td>{!ROUND(opp.UnitPrice,0)}</td>
           <td>{!ROUND(opp.TotalPrice,0)}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
 </font>
       
        </body>
    </html>
</messaging:htmlEmailBody> 
    
<messaging:plainTextEmailBody >
Beste collega,
 
Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity: {!relatedTo.name}
Controleer voordat je wijzigingen wil doorvoeren of je aan het opportunity team van deze opportunity bent gekoppeld, anders krijg je de foutmelding dat je hier geen rechten voor hebt.
Mocht je nog niet aan het opportunityteam zijn gekoppeld neem dan contact op met {!relatedTo.owner.name}.

Account: {!relatedTo.Account.name}
Opportunity eigenaar: {!relatedTo.owner.name}
Opportunity fairshare bedrag: {!ROUND(relatedTo.Amount,0)} 
Opportunity gunningsdatum: {!relatedTo.CloseDate}  


[ Dienst Naam ] - [ Dienst specificatie ] - [ Hoeveelheid ] - [ Verkoopprijs] - [ Totale fairshare waarde label ]
----------------------------------------------------------------------------------------------------------------------------------------------

<apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
[ {!opp.PriceBookEntry.name} ] - [ {!opp.Service_specification__c} ] - [ {!ROUND(opp.Quantity,0)} ] - [ {!ROUND(opp.UnitPrice,0)} ] - [ {!ROUND(opp.TotalPrice,0)} ]
</apex:repeat>

</messaging:plainTextEmailBody>       
        
</messaging:emailTemplate>

 

  • May 03, 2013
  • Like
  • 0

Hi,

 

I need some help with my URL hacking. I want to create a new button on the accountpage to create a child account.

So I only need to pre-populate the parent name and the recordtype. When clicking on the new button it opens a new account, with the correct recordtype but without the name of the account in the parent field.

 

I'm not sure if I have to use the fieldnames for Parent and ParentID, perhaps there are some other ID's for these fields.....

 

/001/e?Parent={!Account.Name}&ParentId={!Account.Id}&RecordType=01220000000Q3wo&retURL=/{!Account.Id} 

 

Thanks

  • April 05, 2013
  • Like
  • 0

Hi,

 

I'm trying to create a trigger on attachment. If the attachment contains the text "RFP" then the checkbox "RFP_check__c" has to be checked.

 

// Trigger to update the RFP_check__c custom checkbox field in Opportunity (Opportunity) if it has an attachment containing RFP.

            trigger TiggerName on attachment (after insert)

            {

                        List<Opportunity> co = [select id, Attachment__c from Opportunity where id =: Trigger.New[0].ParentId];

                        if(co.size()>0) && att.Name.toLowerCase().contains('RFP')) 

                        {

                                    co[0].RFP_check__c = true;

                                    update co;

                        }                                                                   

            }

 

 Eclipse is giving me the error : Unexpected token &&

 

And the following error:

Screenshot

 

  • November 30, 2012
  • Like
  • 0

Hi,

 

I've tried to create a workflow to copy the field accountstage (invisible for users, just for reporting) to a new event. But this is not possible unfortunately.

Is it possible to create a trigger only on event creation that copies the field accountstage to the custom field Accountstage on event? Does anyone have an example or an idea, triggers are not my specialty :)

  • October 03, 2012
  • Like
  • 0

Hi,

 

Does anyone have an example how to create a trigger (and test class) to update all contracts, when the lastmodified date of a custom object is changed?

 

I need this because I created some cross-object date formulas on the contract object, which have to be updated every time a change has been made in the custom object. A workflow (time-trigger) will send the owner a warning several days before. 

 

I've already tried this app http://appexchange.salesforce.com/listingDetail?listingId=a0N300000023bFjEAI

but it's only working for standard objects, unless you pay. 

 

Thanks

  • July 20, 2012
  • Like
  • 0

Hi,

 

can someone help me in creating a good test class.....

 

this is my working trigger:

 

trigger Postalcodelookup on Account (before insert, before update) {
    List<String> Postalcodes4dig = new List<String>(); 
    
    for (Account a:Trigger.new){
        Postalcodes4dig.add(a.Postalcode_4dig__c);
    }

    List <Postalcode__c> PostalCodeList = [Select ID, Name from Postalcode__c where Name in :Postalcodes4dig];

    for (Integer i = 0; i <Trigger.new.size(); i++){
        if (PostalCodeList.size() > 0 && Trigger.new[i].Postalcode_4dig__c !=null){
                        for (Postalcode__c z:PostalCodeList){
                if (Trigger.new[i].Postalcode_4dig__c == z.name){
                        Trigger.new[i].PostalcodeLookup__c = z.ID;
                                }
                        }
        }
        else{
        Trigger.new[i].PostalcodeLookup__c = null;
        }
        
    }
}

 

 

And I start my test with the following:

 

@isTest
// test for the 'Postalcodelookup'trigger
private class Postalcodelookup {
static testMethod void test() {

        account[] Accounttest = new account[]{
         new account(Name='TEST', Shippingstreet = 'Street 10', Shippingpostalcode = '1100 AA', Shippingcity = 'Stad', Shippingcountry = 'Nederland', Phone = '077-5401111',Type = 'Prospect', Potential_amount__c = 1000000,Industry = 'Hospitality', Sub_Industry__c = 'Cultuur', Business_Unit__c = 'Zuid', Account_stage__c = 'Suspect'),
         new account(Name='TEST', Shippingstreet = 'Street 10', Shippingpostalcode = '1000 CD', Shippingcity = 'Stad', Shippingcountry = 'Nederland', Phone = '077-5401111',Type = 'Prospect', Potential_amount__c = 1000000,Industry = 'Hospitality', Sub_Industry__c = 'Cultuur', Business_Unit__c = 'Zuid', Account_stage__c = 'Suspect')
         };

 

But I don't know how to make it complete with system.assert etc....

 

Can someone please help :)

 

thanks 

  • July 10, 2012
  • Like
  • 0

Hi,

 

Does anyone have an example how to write a trigger to update a lookupfield with a custom field in the same object?

 

My example:

 

I want to insert the field "Postalcode 4 dig" into the lookup field "Postcode". See screenshot:

 

 

 

 

When I manually insert the "Postalcode 4 dig" into the lookup field "Postcode" two fields will automatically be filled with help of a cross-object formula. So everything is working fine, except I don't want that the users have to copy the 4 digit postalcode into the lookup field.

 

Thanks!

 

  • May 24, 2012
  • Like
  • 0

Hi,

 

This is the first trigger I'm trying to write, and ofcourse I retrieve an error:

 

System.StringException: Invalid id: 5911

 

To explain. I managed to create  a lookup relation between Account and an object with postalcodes.

By inserting a 4 digit postalcode into the lookupfield "Postcode__c"  three fields are automatically filled, this is working perfectly. 

This trigger needs to populate the lookup field "Postcode__c" with the value from the formula field

"Postalcode_4dig__c" (this is a left formula getting only the numbers from the shippingpostalcode) --> so that the user doesn't have to manually copy the "Postalcode_4dig__c" into the lookupfield.

 

 

// This trigger populates the field "Postcode"
trigger tgrPopulatePostcode on Account (before insert, before update) { 
for(Account a : trigger.new){ 
// write custom lookupfield "Postcode" 
a.Postcode__c = a.Postalcode_4dig__c;
} 
}

 

Testclass

 

@isTest
// test for the 'Populate Postcode' trigger
private class tstPopulatePostcode {
static testMethod void test() {
// create dummy Account
Account a = new Account(Name='TEST', Shippingstreet = 'Street 10', Shippingpostalcode = '5911 BB', Shippingcity = 'Stad', Shippingcountry = 'Nederland', Phone = '077-5401111',Type = 'Prospect', Potential_amount__c = 1000000,
Industry = 'Hospitality', Sub_Industry__c = 'Cultuur', Business_Unit__c = 'Zuid', Account_stage__c = 'Suspect');

insert a;

// get the custom "Postcode" field value
a.Postcode__c = [SELECT Postalcode_4dig__c FROM Account WHERE
Id = :a.Id LIMIT 1].Postalcode_4dig__c;

// test "Postcode" 
System.assert( a.Postcode__c == a.Postalcode_4dig__c);

}
}

 

What am I doing wrong?

 

Thanks

  • May 11, 2012
  • Like
  • 0
Hi,

Can anybody help me with a test class for this trigger? I've asked the author of the trigger to send me the test class, but no response. And I'm not familiar with writing triggers / test classes. I've got it working in my sandbox, but I can't deploy it in my production without a test class.

public class LookupCalculation{
    
    public enum Method {COUNT, SUM, MIN, MAX, AVG}
    
    private string sobjectParent,
                   relationName,
                   formulaParent,
                   sobjectChild,
                   parentfield,
                   fieldChild;
    
    public LookupCalculation(string mysobjectParent, string myrelationName, string myformulaParent,
                             string mysobjectChild, string myparentfield, string myfieldChild){
        sobjectParent = mysobjectParent;
        relationName = myrelationName;
        formulaParent = myformulaParent;
        sobjectChild = mysobjectChild;
        parentfield = myparentfield;
        fieldChild = myfieldChild;
    }
    
    public void Calculate(Method calculation, List<sobject> childList){
        set<Id> parentIdSet = new set<Id>();
        for(sobject sobj : childList)
            parentIdSet.add((Id) sobj.get(parentfield));
        string soqlParent = 'select id, (select ' + fieldChild + ' from ' + relationName + ') from ' + sobjectParent + '';
        List<sobject> parentList = Database.query(soqlParent);
        for(sobject parent : parentList){
            List<sobject> children = parent.getSObjects(relationName);
            if(children == null)
                children = new List<sobject>();
            Decimal counter = (mustSum(calculation))? 0 : null;
            if(calculation == Method.COUNT)
                counter = children.size();
            for(sobject child : children){
                Decimal value = (Decimal) child.get(fieldChild);
                if(mustSum(calculation) && value != null)
                    counter += value;
                else if(calculation == Method.MIN && (counter == null || value < counter))
                    counter = value;
                else if(calculation == Method.MAX && (counter == null || value > counter))
                    counter = value;
            }
            if(calculation == Method.AVG && children.size() > 0)
                counter = counter / children.size();
            parent.put(formulaParent, counter);
        }
        update parentList;
    }
    
    private boolean mustSum(Method calculation){
        return (calculation == Method.SUM || calculation == Method.AVG);
    }
    
}

---------------------------------------------------------------------------------------------

trigger InvoiceLineRollUp on Invoice_Line__c (after insert,after update,after delete,after undelete) {
    
    /*******************TO BE CUSTOMIZED*********************/
    string mysobjectParent = 'Invoice__c',      // Parent sobject API Name
           myrelationName = 'Invoice_Lines__r', // Api name of the relation between parent and child (ends with __r)
           myformulaParent = 'Total__c',        // Api name of the number field that will contain the calculation
           mysobjectChild = 'Invoice_Line__c',  // Child sobject API Name
           myparentfield = 'Parent_Invoice__c', // Api name of the lookup field on chield object
           myfieldChild = 'Amount__c';          // Api name of the child field to roll up
    
    LookupCalculation.Method method = LookupCalculation.Method.SUM; //Selected method: could be COUNT, SUM, MIN, MAX, AVG
    /*******************************************************/
    
    LookupCalculation calculation = new LookupCalculation(mysobjectParent, myrelationName, myformulaParent,
                                                          mysobjectChild, myparentfield, myfieldChild);
    List<sobject> objList = new List<sobject>((List<sobject>) Trigger.new);
    if(Trigger.isDelete)
        objList = Trigger.old;
    if(Trigger.isUpdate)
        objList.addAll((List<sobject>) Trigger.old);
    calculation.calculate(method, objList);
}


See website: http://blog.elieperez.net/salesforce-lookup-roll-up-summary/
  • February 17, 2014
  • Like
  • 1
Hi,

For a client I need to create a simple table with the most important reports of the organisation.
The idea is to create a tabbed visualforce page, so the user can choose between: Accountmanagement, Salesmanagement and Targets

See code:

<apex:page >
    <apex:tabPanel >
        <apex:tab label="Accountmanagement reports">
            <apex:include pageName="NAME OF VF PAGE for accountmanagement"/>
        </apex:tab>
        <apex:tab label="Salesmanagement reports">
            <apex:include pageName="NAME OF VF PAGE for salesmanagement"/>
        </apex:tab>
        <apex:tab label="Salesmanagement targets">
            <apex:include pageName="NAME OF VF PAGE for targets"/>
        </apex:tab>
    </apex:tabPanel>
</apex:page>

For the table I've created a html page with css style. It's probably not the correct way to include css style, but the page is working. 
But when I place this page into the section <apex:include pageName="NAME OF VF PAGE for accountmanagement"/> the complete page  including the tab page is taking over the css style and it's not looking how it supposes to...

This is the code of one of the vf pages:

<apex:page standardstylesheets="false" showheader="false">
<html lang="en">
<head>
  <title>Simple Table</title>
  <script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script type="text/javascript">
$(function() {
/* For zebra striping */
$("table tr:nth-child(odd)").addClass("odd-row");
/* For cell text alignment */
$("table td:first-child, table th:first-child").addClass("first");
/* For removing the last border */
$("table td:last-child, table th:last-child").addClass("last");
});
  </script>
  <style type="text/css">
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
margin:0;
padding:0;
font:12px/15px "Helvetica Neue",Arial, Helvetica, sans-serif;
color: #555;
background:#f5f5f5 url(bg.jpg);
}
a {color:#666;}
#content {width:65%; max-width:690px; margin:6% auto 0;}
/*
Pretty Table Styling
CSS Tricks also has a nice writeup: http://css-tricks.com/feature-table-design/
*/
table {
overflow:hidden;
border:1px solid #d3d3d3;
background:#fefefe;
width:70%;
margin:5% auto 0;
-moz-border-radius:5px; /* FF1+ */
-webkit-border-radius:5px; /* Saf3-4 */
border-radius:5px;
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}
th, td {padding:18px 28px 18px; text-align:center; }
th {padding-top:22px; text-shadow: 1px 1px 1px #fff; background:#e8eaeb;}
td {border-top:1px solid #e0e0e0; border-right:1px solid #e0e0e0;}
tr.odd-row td {background:#f6f6f6;}
td.first, th.first {text-align:left}
td.last {border-right:none;}
/*
Background gradients are completely unnecessary but a neat effect.
*/
td {
background: -moz-linear-gradient(100% 25% 90deg, #fefefe, #f9f9f9);
background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f9f9f9), to(#fefefe));
}
tr.odd-row td {
background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
}
th {
background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
}
/*
I know this is annoying, but we need additional styling so webkit will recognize rounded corners on background elements.
Nice write up of this issue: http://www.onenaught.com/posts/266/css-inner-elements-breaking-border-radius
And, since we've applied the background colors to td/th element because of IE, Gecko browsers also need it.
*/
tr:first-child th.first {
-moz-border-radius-topleft:5px;
-webkit-border-top-left-radius:5px; /* Saf3-4 */
}
tr:first-child th.last {
-moz-border-radius-topright:5px;
-webkit-border-top-right-radius:5px; /* Saf3-4 */
}
tr:last-child td.first {
-moz-border-radius-bottomleft:5px;
-webkit-border-bottom-left-radius:5px; /* Saf3-4 */
}
tr:last-child td.last {
-moz-border-radius-bottomright:5px;
-webkit-border-bottom-right-radius:5px; /* Saf3-4 */
}
  </style>
</head>
<body>
<div style="margin-left: 0px; width: 1166px;" id="content">
<table cellspacing="0">
  <tbody>
    <tr>
      <th style="width: 103px;">Description</th>
      <th style="width: 9px;">Total</th>
      <th style="width: 60px;">Unit 1</th>
      <th style="width: 60px;">Unit 2</th>
      <th style="width: 60px;">Unit 3</th>
      <th style="width: 60px;">Unit 4</th>
      <th style="width: 60px;">Unit 5</th>
      <th style="width: 60px;">Unit 6</th>
      <th style="width: 60px;">Unit 7</th>
      <th style="width: 60px;">Unit 8</th>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
end of contract</td>
      <td style="width: 9px;"><a
href="https://eu3.salesforce.com/000"
target="_blank">Sales</a></td>
      <td style="width: 60px;"><a
href="https://eu3.salesforce.com/000"
target="_blank">Sales</a><br></br>
-
      <span style="font-size: small; font-family: verdana,geneva;"></span><a
href="https://eu3.salesforce.com/000"
target="_blank">Account</a></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Expected
tenders</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Open
opps</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
lost</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="font-weight: bold; width: 103px;">Opps
won</td>
      <td style="width: 9px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
      <td style="width: 60px;"></td>
    </tr>
    <tr>
      <td style="width: 103px;"><span
style="font-weight: bold;">Dashboard</span></td>
      <td style="width: 9px;"></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>

</apex:page>

 
I probably need to add this line: <apex:stylesheet value="{URLFOR($Resourse.Style_table, 'Style_table.css')}"/> somehow....
Style_table is the css zipfile i've added to static resources.

Can anyone please help me, I'm a very beginner in vf.

thanks!
  • February 07, 2014
  • Like
  • 0

Hi,

 

is it possible to create an opportunity line item tab?

We've created a custom owner field on the opportunity products for our specialty sales departments.

They can't use the list views in opportunities (f.e. my open opportunities, my lost opps etc) so they need one based on opportunity line items. Is this possible?

 

I hope someone can point me in the right direction.

 

Thanks 

  • December 03, 2013
  • Like
  • 0

Hi,

 

Due to security issues we need to rebuild the contract object in a new custom object.

Is there a posibility to clone the contract object (with all the fields 100+) and records to a new custom object?

 

thanks

 

juul

  • October 04, 2013
  • Like
  • 0

Hi ,

 

What do I need to change to refer to a thank you page after pressing the button "Update"?

 

Class:

 

public class UpdateCampaignMemberClass{

    public final CampaignMember cm;

    private ApexPages.StandardController cmController;

    public UpdateCampaignMemberClass(ApexPages.StandardController controller) {
        cmController = controller;
        this.cm= (CampaignMember)controller.getRecord();
    }

    public PageReference UpdateAction() {
             try{
            update cm;
            }
            catch(DmlException ex){
            ApexPages.addMessages(ex);
            }
       
       return new PageReference('http://test.force.com/web2campaign/?id=' + cm.id );
    }   public string getStatus(string Status){
            return 'Test__c';
            return 'Test_2__c';
   } 
    
      
       
 }

VF:

 

<apex:page standardController="CampaignMember" extensions="UpdateCampaignMemberClass" sidebar="false" showHeader="false">

<script type="text/javascript"> 

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
} } 

function showAlert(variable){
    alert(variable);
    }
</script>

<apex:form >
    <b>Campaign Member ID </b><apex:inputfield value="{!campaignmember.Id}"/><br/><br/>
            Status <apex:inputfield value="{!campaignmember.Test__c}"/><br/><br/>
            Status <apex:inputfield value="{!campaignmember.Test_2__c}"/><br/><br/>
    <apex:commandButton value="Update" action="{!UpdateAction}" />
    
    
    

</apex:form>
</apex:page>

 

 

 

  • September 03, 2013
  • Like
  • 0

Hi,

I've created a visualforce template with help of this app: https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016cYlEAI

When I generate a test (email) with myself as user and a test opportunity everything is working fine. It displays all the product data.
But when the workflow is triggered and I receive a notification email, there is no data visible in the email.

What's going wrong? (sorry for the Dutch text...)

<messaging:emailTemplate recipientType="User"
    relatedToType="Opportunity"
    subject="Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity: {!relatedTo.name}">
    
<messaging:htmlEmailBody >        
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Beste collega,</p>
        <p>Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity:<b> {!relatedTo.name}</b>.</p>
        <p>Controleer voordat je wijzigingen wil doorvoeren of je aan het opportunity team van deze opportunity bent gekoppeld, anders krijg je de foutmelding dat je hier geen rechten voor hebt.</p>
        <p>Mocht je nog niet aan het opportunityteam zijn gekoppeld neem dan contact op met {!relatedTo.owner.name}.</p>
        
        <br/>Account: <i> {!relatedTo.Account.name}  </i>  
        <br/>Opportunity eigenaar: {!relatedTo.owner.name}
        <br/>Opportunity fairshare waarde: {!ROUND(relatedTo.Amount,0)} 
        <br/>Opportunity gunningsdatum: {!relatedTo.CloseDate}  
   
        <p/>                  
       <table border="0" >
                 <tr > 
                     <th>Actie</th><th>Dienstnaam</th><th>Dienst specificatie</th><th>Hoeveelheid</th><th>Verkoopprijs</th><th>Totale fairshare waarde label</th>
                  </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://emea.salesforce.com/{!opp.id}">View</a> |  
           <a href="https://emea.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!opp.Service_specification__c}</td>
           <td>{!ROUND(opp.Quantity,0)}</td>
           <td>{!ROUND(opp.UnitPrice,0)}</td>
           <td>{!ROUND(opp.TotalPrice,0)}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
 </font>
       
        </body>
    </html>
</messaging:htmlEmailBody> 
    
<messaging:plainTextEmailBody >
Beste collega,
 
Je bent zojuist toegevoegd aan de dienstenlijst van de Opportunity: {!relatedTo.name}
Controleer voordat je wijzigingen wil doorvoeren of je aan het opportunity team van deze opportunity bent gekoppeld, anders krijg je de foutmelding dat je hier geen rechten voor hebt.
Mocht je nog niet aan het opportunityteam zijn gekoppeld neem dan contact op met {!relatedTo.owner.name}.

Account: {!relatedTo.Account.name}
Opportunity eigenaar: {!relatedTo.owner.name}
Opportunity fairshare bedrag: {!ROUND(relatedTo.Amount,0)} 
Opportunity gunningsdatum: {!relatedTo.CloseDate}  


[ Dienst Naam ] - [ Dienst specificatie ] - [ Hoeveelheid ] - [ Verkoopprijs] - [ Totale fairshare waarde label ]
----------------------------------------------------------------------------------------------------------------------------------------------

<apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
[ {!opp.PriceBookEntry.name} ] - [ {!opp.Service_specification__c} ] - [ {!ROUND(opp.Quantity,0)} ] - [ {!ROUND(opp.UnitPrice,0)} ] - [ {!ROUND(opp.TotalPrice,0)} ]
</apex:repeat>

</messaging:plainTextEmailBody>       
        
</messaging:emailTemplate>

 

  • May 03, 2013
  • Like
  • 0

Hi,

 

I need some help with my URL hacking. I want to create a new button on the accountpage to create a child account.

So I only need to pre-populate the parent name and the recordtype. When clicking on the new button it opens a new account, with the correct recordtype but without the name of the account in the parent field.

 

I'm not sure if I have to use the fieldnames for Parent and ParentID, perhaps there are some other ID's for these fields.....

 

/001/e?Parent={!Account.Name}&ParentId={!Account.Id}&RecordType=01220000000Q3wo&retURL=/{!Account.Id} 

 

Thanks

  • April 05, 2013
  • Like
  • 0

Hi,

 

I'm trying to create a trigger on attachment. If the attachment contains the text "RFP" then the checkbox "RFP_check__c" has to be checked.

 

// Trigger to update the RFP_check__c custom checkbox field in Opportunity (Opportunity) if it has an attachment containing RFP.

            trigger TiggerName on attachment (after insert)

            {

                        List<Opportunity> co = [select id, Attachment__c from Opportunity where id =: Trigger.New[0].ParentId];

                        if(co.size()>0) && att.Name.toLowerCase().contains('RFP')) 

                        {

                                    co[0].RFP_check__c = true;

                                    update co;

                        }                                                                   

            }

 

 Eclipse is giving me the error : Unexpected token &&

 

And the following error:

Screenshot

 

  • November 30, 2012
  • Like
  • 0

Hi,

 

I've tried to create a workflow to copy the field accountstage (invisible for users, just for reporting) to a new event. But this is not possible unfortunately.

Is it possible to create a trigger only on event creation that copies the field accountstage to the custom field Accountstage on event? Does anyone have an example or an idea, triggers are not my specialty :)

  • October 03, 2012
  • Like
  • 0

Hello everyone,

 

Is there any way to update an Opportunity field when a Sales Team (Opportunity Team Selling) is specified?  We prefer Salesforce tools, we won't develop APEX code for this.

 

Thanks in advance!

 

 

 

 

  • August 20, 2012
  • Like
  • 0

I need to write some validatio/trigger on attachment object. Is there any possibility of doing that ?

I'm using the Campaign Membership Manager 1.0 app by Force.com Labs. Unfortunately, it seems that having mutli-currency enabled is causing a problem with the code. 

 

Invalid field CurrencyIsoCode for SObject CampaignMember 

 

I attempted to resolve this problem myself by updating the query in the app controller by adding the CurrencyIsoCode to both the CampaignMember and Campaign queries. But, I get this error when I try to save in Eclipse:

 

No such column 'CurrencyIsoCode' on entity 'CampaignMember'.

 

I have double checked the spelling and actually copied the api name from the Setup > Campaign Members field listing. So, I know that it exists on the CampaignMember object. I'm just confused as to why it won't let me include that field.

 

It's pretty pointless because we aren't using the Multi-Currency field. We enabled it in the past because a consultant told us to but we are only using dollars.

 

Here is the query that I am updating:

 

 

        for( CampaignMember cm: [ Select Id, CurrencyIsoCode, 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 ) );
        }
        

 

Any tips as to why this may be happening or how I can reformat the query?

 

Hi,

 

I want to update the Campaign Member Status using the Force.com Sites. I just want ot know how i can pass the Campaign Member Id the Force.comSites URL. I have written one Custom Controller which will update the Camapign Status. Here i hardcoded the Campaign Member. Please suggest me how to pass theCampaign Member Id to the Sites URL.

 

Ex Site URL:http://Mysites-developer-edition.na6.force.com/test?id=701800000009EWSX

 

"701800000009EWSX" This isCampaign Member Id.

 

 

Thanks

Srikanth.K