• MicheleMcgeoy
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 9
    Replies
I am having a challenge with reports taking super long and sometimes timing out. As I am working on testing and optimizing, I find it challenging not knowing what's happening with caching.
Is there any way to flush the cache so I know i'm starting clean? If not, how often does it flush?

thanks, Michele

I'm trying to assess if the day of week is Monday, but get the following error:

Method does not exist or incorrect signature: DAY_IN_WEEK(Date)

 

If (DAY_IN_WEEK(Camp.startdate) = 2) {
// do something
} else {
// do nothing
}

 

Any ideas?

Thanks, Michele

I am trying to concatentate a text field with a date without including the time and am getting an error: Method does not exist or incorrect signature: [Date].format(String)

 

     Date NewDate = Camp.Startdate;

// Line below gives CampName2013-12-02 00:00:00
        NewCamp1.Name = camp.name + NewDate;


// Line below gives error: Method does not exist or incorrect signature: [Date].format(String)
       NewCamp1.Name = camp.name + NewDate.format('MM/dd/yyyy');

What am I doing wrong?

 

Thanks, Michele

According to the documentation,

CampaignId field on campaignmember record, is not updatable, its only createable.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_campaignmember.htm

 

How would I then copy to a table and then append versus update?

 

I'm trying this, but getting an error:

List<CampaignMember> Members = [SELECT id, contactid,status from CampaignMember where campaignid = :camp.id ];

// Change campaign ids to the newly cloned campaign id
// This loop below gives me error msg: Field is not writeable: CampaignMember.CampaignId
for(CampaignMember m : members){
   m.Campaignid = Newcamp1.id;
   }
// Update the database
 insert members;

 

thanks, Michele

I am having trouble changing the CampaignId in CampaignMember object. I get the following error: Field is not writeable: CampaignMember.CampaignId. The error comes from the for loop at the very bottom.

Any ideas???

Thanks, Michele

 

public class CloneClassAttendance {
    private final Campaign camp;
    
    public CloneClassAttendance(ApexPages.StandardController stdController){
        this.camp = (Campaign)stdController.getRecord();
    }

    public void insertRecord(){
// Clone the campaign record
        Campaign NewCamp = new Campaign(Name = 'Test Campaign record');
        insert NewCamp;

        Campaign NewCamp1 = [SELECT Type, Status FROM Campaign WHERE Name = 'Test Campaign record'];
        NewCamp1.Type = 'Class Attendance';
        NewCamp1.IsActive = true;      
        NewCamp1.Name = camp.name + camp.startdate + 7;
        NewCamp1.Parentid = camp.id;
        NewCamp1.Startdate = camp.startdate + 7;
        NewCamp1.teacher__c = camp.teacher__c;
        NewCamp1.Day_of_Week__c = camp.Day_of_Week__c;
        NewCamp1.Hours_Per_Class__c = camp.Hours_Per_Class__c;
        NewCamp1.Location__c = camp.Location__c;
        NewCamp1.End_Time__c = camp.End_Time__c;
        NewCamp1.Description = camp.Description;
        
        update NewCamp1;

// Clone all records in CampaignMember
// Select records in CampaignMember from new campaign
//Create list of members for new campaign above.
 

List<CampaignMember> Members = [SELECT id, contactid,status from CampaignMember where campaignid = :camp.id ];


// Change campaign ids to the newly cloned campaign id
// This loop below gives me error msg: Field is not writeable: CampaignMember.CampaignId
for(CampaignMember m : members){
   m.Campaignid = Newcamp1.id;
   }

// Update the database
 insert members;
    }
}

 

 

I am new to Visual Force, so please excuse me if it's a basic question. I am trying to clone a campaign and all it's members and am having trouble pulling the new campaign id into the members, but I don't seem to be able to get the campaignid from the original campaign that i'm cloning. I get the error message:

Compile Error: unexpected token: 'Camp.id' at line 32

 

Here's the code:

public class CloneClassAttendance {
    private final Campaign camp;
    
    public CloneClassAttendance(ApexPages.StandardController stdController){
        this.camp = (Campaign)stdController.getRecord();
    }

    public void insertRecord(){
// Clone the campaign record
        Campaign NewCamp = new Campaign(Name = 'Test Campaign record');
        insert NewCamp;

        Campaign NewCamp1 = [SELECT Type, Status FROM Campaign WHERE Name = 'Test Campaign record'];
        NewCamp1.Type = 'Class Attendance';
        NewCamp1.IsActive = true;      
        NewCamp1.Name = camp.name + camp.startdate + 7;
        NewCamp1.Parentid = camp.id;
        NewCamp1.Startdate = camp.startdate + 7;
        
        update NewCamp1;

// Clone all records in CampaignMember
// Select records in CampaignMember from new campaign
//Create list of members for new campaign above.

 

//This line is where I get the error: Compile Error: unexpected token: 'Camp.id'
List<CampaignMember> Members = [SELECT id, contactid,status from CampaignMember where campaignid = Camp.id ];

// Change campaign ids

 

for(CampaignMember m : members){
   m.id = Newcamp1.id;
}

// Update the database
insert members;
    }
}

 

The Visual Force page is called from a button on the Campaign record:

<apex:page standardController="Campaign" extensions="CloneClassAttendance" action="{!insertRecord}">

  <h1>Cloning Attendance</h1>
  <p> Class name is {! campaign.name} </p>
  <p> Class id is:   {! campaign.id} </p>
  <p> Class start date is:   {! campaign.startdate} </p>
  <p> Class end date is:   {! campaign.enddate} </p>
  <p> Next week is: {! campaign.startdate+7} </p>
</apex:page>

I'm new to coding, so my apologies for the basic question. I've put a button on the Campaign layout that calls a Visual Force page that puts some values on the screen. I then want it to run the following Apex code:

 

public CloneClassAttendance() {
Campaign NewCamp = new Campaign(Name = 'Test Campaign record');
insert NewCamp;

Campaign NewCamp = [SELECT Type FROM Campaign WHERE Name =:'Test Campaign record' limit 1];

NewCamp.Type = 'Class Attendance';

update NewCamp;
}
}

 

What do I put in the Visual Force page to run the CloneClassAttendance class?

 

Thanks, Michele

I am brand new to Apex, so please forgive the basic question, but I am getting the following error from this Apex class: Compile Error: expecting right curly bracket, found 'insert' at line 3

 

public class CloneClassAttendance {

Campaign NewCamp = new Campaign(Name = 'Test Campaign record');

insert NewCamp;

 

Campaign NewCamp = [SELECT Type FROM Campaign WHERE Name = 'Test Campaign record'];

NewCamp.Type = 'Class Attendance';

update NewCamp;

}

 

Any help would be much appreciated.

Thanks, Michele

I'm trying to do a select for data for the currently logged in user with the global variable {!$User.id} in a trigger.
This statement runs fine:
[SELECT j.id, j.Subject, j.CallDurationInSeconds, j.CreatedDate, j.status, j.Description, j.CreatedByID  
FROM Task  j  WHERE (j.CreatedDate = today AND CreatedByID = '00540000001Gii5AAC' AND j.Status = 'Completed')
But when I replace the hard coded ID with {!User.id} I get an error.
Thanks, Michele

I'm new to Visual Force, so please forgive the basic question...

 

I created a simple flow that does a lookup by name and then I assign the variable {!flowContactID} to the found contact id. I then want to send the user back to the screen for that contact. In the flow, I set {!flowContactID} as input/output

 

<apex:page >
<flow:interview name="Test_Contact_Add_and_Exit" finishLocation="{!URLFOR('/'&{!flowContactID})}"/>
</apex:page>

 

I get a syntax error with the Visual Force page above. Do I also need to declare the {!flowContactID} variable within Visual Force?

 

Thanks, Michele

I am having trouble changing the CampaignId in CampaignMember object. I get the following error: Field is not writeable: CampaignMember.CampaignId. The error comes from the for loop at the very bottom.

Any ideas???

Thanks, Michele

 

public class CloneClassAttendance {
    private final Campaign camp;
    
    public CloneClassAttendance(ApexPages.StandardController stdController){
        this.camp = (Campaign)stdController.getRecord();
    }

    public void insertRecord(){
// Clone the campaign record
        Campaign NewCamp = new Campaign(Name = 'Test Campaign record');
        insert NewCamp;

        Campaign NewCamp1 = [SELECT Type, Status FROM Campaign WHERE Name = 'Test Campaign record'];
        NewCamp1.Type = 'Class Attendance';
        NewCamp1.IsActive = true;      
        NewCamp1.Name = camp.name + camp.startdate + 7;
        NewCamp1.Parentid = camp.id;
        NewCamp1.Startdate = camp.startdate + 7;
        NewCamp1.teacher__c = camp.teacher__c;
        NewCamp1.Day_of_Week__c = camp.Day_of_Week__c;
        NewCamp1.Hours_Per_Class__c = camp.Hours_Per_Class__c;
        NewCamp1.Location__c = camp.Location__c;
        NewCamp1.End_Time__c = camp.End_Time__c;
        NewCamp1.Description = camp.Description;
        
        update NewCamp1;

// Clone all records in CampaignMember
// Select records in CampaignMember from new campaign
//Create list of members for new campaign above.
 

List<CampaignMember> Members = [SELECT id, contactid,status from CampaignMember where campaignid = :camp.id ];


// Change campaign ids to the newly cloned campaign id
// This loop below gives me error msg: Field is not writeable: CampaignMember.CampaignId
for(CampaignMember m : members){
   m.Campaignid = Newcamp1.id;
   }

// Update the database
 insert members;
    }
}

 

 

I'm new to coding, so my apologies for the basic question. I've put a button on the Campaign layout that calls a Visual Force page that puts some values on the screen. I then want it to run the following Apex code:

 

public CloneClassAttendance() {
Campaign NewCamp = new Campaign(Name = 'Test Campaign record');
insert NewCamp;

Campaign NewCamp = [SELECT Type FROM Campaign WHERE Name =:'Test Campaign record' limit 1];

NewCamp.Type = 'Class Attendance';

update NewCamp;
}
}

 

What do I put in the Visual Force page to run the CloneClassAttendance class?

 

Thanks, Michele

I am brand new to Apex, so please forgive the basic question, but I am getting the following error from this Apex class: Compile Error: expecting right curly bracket, found 'insert' at line 3

 

public class CloneClassAttendance {

Campaign NewCamp = new Campaign(Name = 'Test Campaign record');

insert NewCamp;

 

Campaign NewCamp = [SELECT Type FROM Campaign WHERE Name = 'Test Campaign record'];

NewCamp.Type = 'Class Attendance';

update NewCamp;

}

 

Any help would be much appreciated.

Thanks, Michele

I'm new to Visual Force, so please forgive the basic question...

 

I created a simple flow that does a lookup by name and then I assign the variable {!flowContactID} to the found contact id. I then want to send the user back to the screen for that contact. In the flow, I set {!flowContactID} as input/output

 

<apex:page >
<flow:interview name="Test_Contact_Add_and_Exit" finishLocation="{!URLFOR('/'&{!flowContactID})}"/>
</apex:page>

 

I get a syntax error with the Visual Force page above. Do I also need to declare the {!flowContactID} variable within Visual Force?

 

Thanks, Michele

I have successfully embedded my Flow into a new visualforce page, created a custom button to run the component, and everything is working perfectly, except for the finishLocation. The flow is generated from an account, and I want the user to return to the account when the flow has been completed. 

 

After scouring the boards for a few hours and trying differnt potential solutions (including: http://boards.developerforce.com/t5/Visual-Workflow/Flow-finishLocation-equal-to-originating-record/m-p/534037#M912), I can't seem to get this thing to work! The flow is generated from the account, and it is used to create an event and/or a task on the account record.

 

Here is the code:

 

<apex:page standardController="Account" tabStyle="Account">
    <flow:interview name="NA_AR_Sales_Call_Wizard" finishLocation="{!URLFOR('/{!Account.Id}')}">
        <apex:param name="varAccountID" value="{!Account.ID}"/>
    </flow:interview>
</apex:page>