• Bhushan Patil 44
  • 5 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2

I geting the Too Many SOQL Queries:101 in below Line in webservice class

 List <Custom_Notification__c> notificationList = [SELECT Account_Id__c, Application_Id__c, Loan_App_Id__c, 
                                                              Message__c, Notify_Date__c 
                                                              FROM Custom_Notification__c
                                                              WHERE Account_Id__c =: accountId
                                                              AND User_Type__c =: account.Type
                                                              ORDER BY Notify_Date__c desc
                                                              LIMIT 3];

Vinuthh S
Referring to this post: https://developer.salesforce.com/forums/?id=906F00000008l8SIAQ
I tried the "best answer" from that thread, but I get the error "expecting right curly bracket, found '<'".

The "best answer" was:
trigger populateParentAccount on Account (before Insert){<br> List<Lead> convertedLeads=[SELECT Id, ConvertedAccountID, Lead_Parent__c<br> FROM Lead WHERE IsConverted=True AND ConvertedAccountId IN :trigger.new];<br> Map<ID,ID> acctParentMap=new Map<ID,ID>();<br> for (lead l: convertedleads){<br> acctParentMap.put(l.ConvertedAccountId,l.Lead_Parent__c);<br> }<br> for (account a:trigger.new){<br> if (acctParentMap.containsKey(a.Id)){<br> a.<font color="#ff0000">ParentId</font>=acctParentMap.get(a.Id);<br> }<br> }<br>}

Note, I'm using Salesforce Professional edition so Apex isn't natively opened to me. Upgrading everyone to enterprise is out of the question, so  I was hoping to create a trigger in d eveloper edition, then install it as a package in my production, as suggested here: https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/dev_packages_apex_ge_pe.htm . 

Automating this "Parent Account" field would be a lifesafer, because the way our sales works is ALL of our leads have a Lead Parent (a custom picklist which I've added in Lead Stage).

I am also new to Salesforce, please be nice! :( Just started using it a couple of weeks ago and I'm trying to get all our sales processes streamlined before the volume of our leads pick up.

 Having to manually add the Parent Account everytime a Lead is converted is very inefficient, so I would really like to find a way to make this automatic. Since I can't map the lead fields to Parent Account because that is a look-up field.

Thank you!