• ylandra
  • NEWBIE
  • 10 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Can anyone explain to me how the data loader works with triggers in this scenario:  I have 72 records (not a lot IMHO) and my trigger is designed to handle batch records (I don't query records inside any for loop or update any records inside a for loop)  I can post the trigger for validation if needed.  When I try to dataload these 72 records I run into the Too Many SOQL queries: 101 error on all records.  If I change the batch size down to the exact number of records, then it works without a problem.  Does anyone have any idea why this would be?  I'm just trying to figure out if there's something I could do in my code to prevent these errors without having to change the batch size.
Has anyone else had any luck with this?  I have tried saving a custom perspective and a custom workspace and each time I have to add the columns I want to view.  

Thanks,

Desiree
I have this code:
[find 'test' IN ALL FIELDS RETURNING CampaignMember (CampaignId, ContactId, HasResponded, FirstRespondedDate WHERE HasResponded=true and FirstRespondedDate != NULL order by FirstRespondedDate desc)]
and I get an error 'Save error: entity type CampaignMember does not support search' in the Force IDE.

I can use SOQL but not SOSL on CampaignMember?

Any help would be appreciated.

Thanks!

Desiree
I have a trigger that updates fields on the opportunity from contact fields when the opportunity is created from the contact.  The problem I have discovered is that there seems to be no way to simulate this in a unit test.

Does anyone have any ideas about how to test this?
Can anyone explain to me how the data loader works with triggers in this scenario:  I have 72 records (not a lot IMHO) and my trigger is designed to handle batch records (I don't query records inside any for loop or update any records inside a for loop)  I can post the trigger for validation if needed.  When I try to dataload these 72 records I run into the Too Many SOQL queries: 101 error on all records.  If I change the batch size down to the exact number of records, then it works without a problem.  Does anyone have any idea why this would be?  I'm just trying to figure out if there's something I could do in my code to prevent these errors without having to change the batch size.
I have a trigger that updates fields on the opportunity from contact fields when the opportunity is created from the contact.  The problem I have discovered is that there seems to be no way to simulate this in a unit test.

Does anyone have any ideas about how to test this?

I have created a custom object called PTO. I have also created an approval process for it.  How can I create a  trigger so that it automically executed the approval process i have setup as soon as a new PTO record is created(inserted).  This would behave the same way as if I manually pressed the submit approval button.

 

trigger PTO_Trigger on PTO__c (after insert) 
{
for(PTO__c pto: [select id from pto__c])
{
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setObjectId(pto.id);
}
}

 

 

 

Message Edited by bikla78 on 07-15-2009 11:49 PM

I'd like to override the standard Save button for Account objects. I know I can't do that directly, so I thought I'd override the Account Edit page, going to a Visualforce page instead, and then override the standard save action in a controller extension.

 

So I created a new VF page that looks like this:

 

 

<apex:page standardController="Account" extensions="AccountEditController">
<apex:detail subject="{!id}" relatedList="true"/>
</apex:page>

Then I overrode the Account Edit button to go to this page.

 

My first problem is that this page displays in view mode, not edit mode. If I click the Edit button, it (of course) just loads the same page again. How do I get the <apex:detail> component to display in edit mode?

 

My second problem is overriding the standard Save action. I think I can do it with the following in my controller extension:


public class AccountEditController {
private final Account acct;
private ApexPages.StandardController stdController;

public AccountEditController(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
this.stdController = stdController;
}

public PageReference save() {
// Put my own stuff here

// Do the standard save action
return this.stdController.save();
}
}

 

Is that correct?

 

Thanks!

 

MJ.

 

 

 

 

 

 

 

  • April 16, 2009
  • Like
  • 0