• CRM Jedi
  • NEWBIE
  • 25 Points
  • Member since 2009

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

Example of the scenario:

 

The LIMIT - maximum number of query is 20.

 

We have a trigger with 10 queries. So each execution will take away 10 from the LIMIT.

 

After update, field update executes, and cause the trigger to run again. However, the LIMIT is not RESET. When the second execution starts, it starts from the limit of 10 (due to the first execution), which ended up 20 queries in one execution.

 

Our problem now is that we have more than 10 queries in our triggers, multiple execution will cause "Too many SOQL queries: 21" error. Multiple field update will also cause this issue. (this also applies to other limits like script statements)

 

The question here is: Can we reset the LIMIT when field update triggers the trigger again?

Hi,

 

Assuming that Contact has a relationship to Account, and Account has a relationship to Owner (User), how do I get the information of the Owner when I query from the Contact?

 

I've constructed the following query base on the example of the documentation, it doesn't throw any error but I couldn't get the values for the Owner:

 

SELECT Id, Name, Account.Owner.FirstName FROM Contact;

 

 

Is the SOQL correct?

Hi,

I notice this weird behaviour of SFDC when it displays number on a VisualForce page.

 

 

 When the value is "15,000,000", the value displayed is "1.5E+7"

 

 But when I modify the last digit of the value to "15,000,001", it displays correctly as "15000001"

 

 

Is this a SFDC defect?

Hi,

Has anyone have experience in extracting a time portion out of a date time object?

For example: 8/12/2009 2:20 PM

I just want to extract the time 2:20 PM from the date time object above. Please advice.

Your help is expreciated.

 

Paul

 

If I have a try/catch block which does an update to the Database, how do I write a test method to execute the catch? It seems I would have to force the update to fail? 
 

//Save the information entered in by the student

try {

//save the changes that the student made on the form

update enrollment;

}

 

catch(System.DMLException e) {

ApexPages.addMessages(e);

System.debug(e);

return null;

}

 

 
Message Edited by Chris987654321 on 08-09-2009 07:21 PM
Message Edited by Chris987654321 on 08-09-2009 07:23 PM

We're also getting the "Too many script statements" error in another one of our triggers.

 

Any ideas?

 

Thanks,
Brad

 

Here is our code:

 

 

trigger OrderLineTrigger on Order_Line_Item__c (after insert, after update) { List<Case> casesToUpdate = new List<Case>(); Set<String> itemIds = new Set<String>(); Set<Id> contactIds = new Set<Id>(); for(Order_Line_Item__c o : trigger.new) { itemIds.add(o.Marketplace_Item_ID__c); contactIds.add(o.Contact__c); } List<Case> caseList = new List<Case>([Select Id, Item_Id__c, Related_To_Order__c, Related_To_Order_Line__c, SKU__c, ContactId, Contact.Id, eBay_User_Id__c From Case Where Item_Id__c IN : itemIds LIMIT 1000]); Map<ID,Contact> contactMap = new Map<ID,Contact>([Select Id, eBay_User_Id__c From Contact Where Id IN :contactIds LIMIT 1000]); for(Order_Line_Item__c o : trigger.new) { for(Case a : caseList) { String eBayUserId; Contact con; if(contactMap!=null) con = contactMap.get(o.Contact__c); if(con!=null) eBayUserId = con.eBay_User_Id__c; if(a.Item_Id__c == o.Marketplace_Item_ID__c && a.eBay_User_Id__c == eBayUserId) { a.Related_To_Order__c = o.Order__c; a.Related_To_Order_Line__c = o.Id; a.SKU__c = o.Product_Code__c; a.ContactId = o.Contact__c; casesToUpdate.add(a); } } } update casesToUpdate; }

 

 

 

Hi, I'm not sure if Validation rules can do this, perhaps there's a nother way :

 

 

The combination of 3 fields on an Account record must be unique (so no other account record can have the same combination of values in the 3 fields). 2 of these fields are Text fields while one is a picklist.

 

Has anyone been able to do something such as this.

 

Any help will be great!

 

 

 

 

 

 The highlighted statement below never executes when the event.whatid is associated with an account record where account.dlc_territory = San Francisco.

 

Everything else works.  Any help will be greatly appreciated

 

     public static void EventAssign (Event[] EventRec)
{
Set<Id> acctIds = new Set<Id>();
for (Event ev : EventRec)
{
acctIds.add(ev.whatId);
}
Map<Id,String> EventAssignMap = new Map<Id, String>();


for(Account acct: [select id, ownerid from Account where dlc_territory__c != 'San Francisco' and id IN :acctIds])
{

EventAssignMap .put(acct.id, acct.ownerid);


for (Event a:EventRec)
{
if( a.whatid != EventAssignMap.get(acct.id))
{
if (a.meeting_status__c== 'Pending' || a.meeting_status__c== 'Executed')
{
a.ownerid = EventAssignMap .get(a.whatId);
}
}
else if (a.ownerid !='00530000000eQr3AAE' || a.ownerid != '00530000000cvXwAAI')
{
a.ownerid.adderror ('Test');
}




}
}

}

 

Hi all,
I am new to SalesForce.com and would like to know how can I change the label of a related list?

For example,
I was creating a master-detail field for the object Job Posting, when it reached the step where I need to specify the label, I saved it as "Job Posting". But later on I find that I was wrong and would like to change it to something else.

Thank you in advance.