• Ravi Kumar 259
  • NEWBIE
  • 55 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 65
    Questions
  • 20
    Replies
Hi experts,

I have a two objects there are A and B, both are related two each other(Lookup Relation).and I create lookup field in B object, when I can click on lookup icon button in B object , it will show 10 record of A object,I have a requement here, lookup field only allow  4 records out of 10 records.

give me sample code..!
We need to stop Job named "Duplicate Error Log Sweeper" in background jobs, any suggestions will be much appreciated.
List<Campaign> campOBj=[Select id from campaign];
Set<Id> campId=new Set<Id>();
For(Campaign campValues : campOBj)
{
    campId.add(campValues.id);
}
For(Id campIdV : campId)
{
    List<campaignMember> countCM=[Select id from campaignMember where campaignid = : campIdV limit 30000];
}

This is a simple code but its giving error:
System.LimitException: Too many query rows: 50001

In my org their is total number of CAMPAIGN='66'
when is see in my DEBUG: it only work for 12 CAMPAIGN then gives this error:

Values in Debug Log-----
**campId701D0000000d0MQIAY
***count13516
**campId701D0000000cxAWIAY
***count10156
**campId701D0000000cylEIAQ
***count3833
**campId701D0000000cxXpIAI
***count14084
**campId701D0000000cxrfIAA
***count1
**campId701D0000000cwzFIAQ
***count3606

for rest of the 6 campaign its giving 0 count thats why i didnt mention here and after that for this campaign id its showing error and the debug stops-
**campId701D0000000cyZDIAY

what i was thinking when i added all the count its approx 46000 i think thats why the count is going more than 50,000 but its not possible can anyone give me a possible ans why this is giving error. as soql doesn't work like this.
 

      Have u used merge trigger, explain it?