• Anas Alamour
  • NEWBIE
  • 40 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 2
    Replies

I have Batch Apex named "PardotLeadFieldsUpdateBatch" , where : 
1- Start method : The query retirves 49820 Lead record
2- Execute method : I am updating the Lead records as following 
List<Database.SaveResult> updateLeadResult = Database.update(updatedLeads, false);
where updateLeadResult is list defined as following : 
List<Lead> updatedLeads = new List<Lead>();
3- FInish method : I am logging any update error in this method
4- I am setting the batch zise to 200 as following :
Database.executeBatch(new PardotLeadFieldsUpdateBatch(),200);
So , based on the batch size "200", and number of records "49820" , the execute method will be running 249 times. 
Recntly, in some days , not all days , i am getting the following error : 
Apex script unhandled exception by user/organization: 
xxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxx
Failed to process batch for class 'PardotLeadFieldsUpdateBatch' for job id 'xxxxxxxxxxxxxxxxxx'
caused by: System.LimitException: Too many DML statements: 151
Trigger.LeadEncrypt: line 5, column 1
where "LeadEncrypt" is apex trigger on Lead object that update filed on Lead record after insert or update as following :
trigger LeadEncrypt on Lead (after insert, after update) {
// Update field in Lead Object 
}
What do you think the reason for my error : "Too many DML statements: 151" ? Is that becuase my batch size is 200 ? Does that mean , on each time the execute method is runnig , there are 200 update operations on lead object,and that hits the apex limit 150 for DML operations as mentioned in the following link :
https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
But in my code , in one batch , i am inserting all the leads in a list and apply the database update operation on that list , not on 200 record individually. If i reset the batch size to 150 or 100 , does that will fix the error ? or there are another reason for this error ? 

Please advise.

I have requirement to archive old data in my org and i am looking into Big Objects as one of the possible data archiving  solutions. We want to run reports on the archived data stored in Big Objects and found that's possible using SOQL and Async SOQL
https://developer.salesforce.com/docs/atlas.en-us.bigobjects.meta/bigobjects/async_query_build_report.htm
 
But in the above link , there is note that says : Asyc SOQL is scheduled for retirement in all Salesforce orgs as of Spring ’22.
 
Is that correct ? Is there anyone is still using Asyc SOQL with the new release Winter 23? I opened case with salesforce already and they said that is currently out of their scope thus may have limited information related to the matter. They advised me to raise this concern to developer forum or Trailblazer Community and collaborate with other developers\trailblazers.
 
Thanks.
Hello. I have parent object "Contact" with two custom child objects , Contact_Additional_ Info ( Master-Detail) and Program_Registeration ( lookup ). I have already formula field in the second child object(Program_Registeration)  and need it to reference a picklist field in the first sibling object  Contact_Additional_ Info) , is it possible that  a formula field on an object can reference sibling objects ? For some reason , i can't change the type of that formula field to another type or change my design data model. Could you please advise me.

Thanks.
Our staff users in my org have recently reported about getting expired link in outlook app when they wanted to reset their password by clicking on "Forgot Password" in login page. When we checked with salesforce support , they said that there is email server protection software in our side automatically expired the link . They advised us to enable the option "Don't immediately expire links in forgot password emails" in the user profile on salesforce , but they recommended to check with the email protection software support to know what is the issue. My question is there anyone have office 365 as email service and encountered the same issue , if so , how they solved it in Office 365 settings ? 
 

Hi All, 

We migrated our salesforce instance to new instacne on HyperForce in the last month , we have integration with FormTitan platform. with starting our working on the new instance , we sometimes ( not all the times ) getting intergation errors as follwoing : 

  1. connect ETIMEDOUT
  2.  connect ECONNREFUSED
  3. read ECONNRESET
  4. Contact Error: socket hang up
  5. ERROR_HTTP_503: upstream connect error or disconnect/reset before headers. reset reason: connection termination: upstream connect error or disconnect/reset before headers. reset reason: connection termination.
We opened case with FormTitan support.They reviewd these errors and confirmed that these are all coming from salesforce side  - trying to connect to SF and not getting response. We opened case with salesforce support , but we did not get any result.

Any advise pelase? 

Thanks. 

I have a requirment to generate a report for the duplicated leads in our system with the same lead's email address and the one of the lead source in the duplicaed equal "Option1" and the lead source in the other  duplicated leads equal "Option2" . I used the following SOQL query : 

SELECT Count(Id), Email FROM Lead where  LeadSource IN ('Option1','Option2') GROUP BY Email HAVING Count(Id) > 1

I got all the duplicated leads , but my requirment is getting the duplicated  for both options "Option1" and "Option2". we don't need to get the duplicated where the source is equal Option1 or Option2 in both duplicated leads. 

 Is that possible with SOQL or i need Apex code. Please help. 

Thanks. 

We have custom object contains frist name and last names as custom fields. We have a requirment to retrieve all the records where the first name or last name conatins non- english alphapitcal char ( digit, special charcter , non-english char ,..etc) , is that possible with query in SOQL or Apex. Please help. 

Thanks. 
I have a custom object in salesforce Lightning   , there is a requirement when clone a record , all the fields are populated except one text field. I created a custom clone button that uses a hacked URL as next : 

/{!Custom_Object.Id}/e?clone=1&retURL=%2F{!Custome_Object.Id}&00Y5111111B6qjA= 



Where  Custom_Object is the API name of the custom object and 00Y5111111B6qjA is the ID of the text field. 

When i click on the customized Clone button , the value of the text field is not blank. 


Is there any suggestion ? 
I enabled MFA in my organization, my users are using Microsoft Authenticator app. my users concern now is they are required to enter the code ( one-time passwords) in every time they login in. Is there any setting to prevent this behavior on every login using the same location , computer , and the same browser ? 
Salesforce in the documentation said the following :  "All internal users who log in to Salesforce products (including partner solutions) through the user interface must use MFA for every login".
 
Is that means the code is required every time ? i used Salesforce Authenticator and there is option in the app to trust the user location , but with third-party authenticator , there is no this option. Please advise.

User-added image
 
Hi All , i am a new to Apex triggers. i have requirment to update checkbox field in a parent record when delete a child record , this update also based on a specfic condiiton. can anyone help me how to write this trigger and test class code , so i can deploy it to the production. Thanks. 
i have requirement to create new lead based on creating a new record of custom object. i am using process builder and Auto launched flow to implement this requirement. in my flow i am using get records element to look up the custom record, get its fields values, and store them in a record variable. I am using create records element to create the new lead and set the lead fields from the record variable values. All the specified lead fields are filled up with values except picklist field, its value is null. is there any limitation in salesforce to set picklist field from record variable  in flow? If yes, what is the solution for my case?
 
I added a new field in the Contact object. There is child object "Program" related to contact object. I have a requirement to grant edit on the new field for any user has ownership for any record of the child object regardless of the contact ownership , sharing rules , role hirachary ,....etc. i mean if the logging user is th e owner of any child record , he can edit the new field in the conatct object even if he is not the owner of the conatct record or above him in the role hircahry .  is that possible by contact permsiisons , validation rule , apex trigger , apex calss , ...etc? 
I have contact as a parent object and program (custom object ) as child object , the relationship is lookup. I have a requirment to generate report for the contacts that have specific programs , for example , only i need to retrive the conatcs records that have programs with name "A" and "B".  How i can do that using Reports , SOQL query or Aoex code.
I have a requirement to create list view named "My Team Leads". the loggedin user should see in the this list view the next :
Leads owned by the loggedin user 
Leads owned by his direct manager 
Leads owned by any memeber of his team ( the users who have the same direct manager)
For this purpose , i created a new checkbox formula "My Team" with htne next formula :

($User.Id = Owner:User.Id)  || ((Owner:User.Manager.Id = $User.Id) || ((Owner:User.Id = $User.ManagerId)
i created the list view and set the filter by owner =- all leads and  to My team = True 

but when i tested with any user, just i get the leads owned by the user , he did not get the leads owned by his manager or the other team member , any suggestion ? 
i have a requirment to create list view on lead object to present the leads owned by any any active user in the user's business team. i know this feature is not avaliable in salesforce, what is avaliable i nsalesforce is  :
  • All leads
  • My Leads
  • Queue Lead 
lead owner

what i am trying to implement it is "My Team's Lead" list view , that means any lead owned by me or anyone in my team. the nearest implementation for the team in my org is the user public group. my idea is creating a new formula checkbox field in the lead object named "My Team" and set this checkbox to True if the lead owner is any user in any public group of the user public groups. my question is : can i do that in salesforce in my case ? if yes , how i do this checking ?. if not , is there any suggsted solutions to implement this requirment ? 
 
I have lookup parent-child releationship, i need to write apex code to clone record of the child object and link this a colned record to record of the parent objetct, anyone can help me to write this code as Anonymous Apex Code in developer consol. Thank you. 
I am trying to generate report on Queues and thier user members info as next :

Queue name , Queue email , Supported Objects , User full name 

i know this is not possible from Salesforce Reports direclty . so need to query  the three tables : Group , GroupMember , User using SOQL

Can anyone help me how to do that using Apex code ? 

 
I have a custom object and there are three required fields in this custom object ( Country , State, City) . this coustom object has a lookup relation with Contact object. my requirement is , when the staff create a new record for a client and the client has an existing contact file in the system , we need the system populate  these fields from the Conatct object . any one help me to write this trigger. Thanks. 
Our staff users in my org have recently reported about getting expired link in outlook app when they wanted to reset their password by clicking on "Forgot Password" in login page. When we checked with salesforce support , they said that there is email server protection software in our side automatically expired the link . They advised us to enable the option "Don't immediately expire links in forgot password emails" in the user profile on salesforce , but they recommended to check with the email protection software support to know what is the issue. My question is there anyone have office 365 as email service and encountered the same issue , if so , how they solved it in Office 365 settings ? 
 
I added a new field in the Contact object. There is child object "Program" related to contact object. I have a requirement to grant edit on the new field for any user has ownership for any record of the child object regardless of the contact ownership , sharing rules , role hirachary ,....etc. i mean if the logging user is th e owner of any child record , he can edit the new field in the conatct object even if he is not the owner of the conatct record or above him in the role hircahry .  is that possible by contact permsiisons , validation rule , apex trigger , apex calss , ...etc?