Salesforce Admin Tips, Salesforce Developer Tips
This blog post provided about Salesforce Admin Tips and Salesforce Developer Tips
Salesforce Admin Tips:-
Salesforce Admin Tips #1
Add Minutes, Hours to data field using Salesforce Formula field or Salesforce Process Builder or Salesforce Workflow:
Example:
//Add based on mins
Now() + (60/24/60) /* Use this to add 60 mins in your datetime field
Now() + (10/24/60) /* Use this to add 10 mins in your datetime field
DateTimeFieldAPI__c + (10/24/60) /* Use this to add 10 mins in your datetime field
//Subtract based on mins
Now() – (60/24/60) /* Use this to Subtract 60 mins in your datetime field
Now() – (10/24/60) /* Use this to Subtract 10 mins in your datetime field
DateTimeFieldAPI__c – (10/24/60) /* Use this to Subtract 10 mins in your datetime field
Reference:– https://help.salesforce.com/articleView?id=000321563&type=1&mode=1
Salesforce Admin Tips #2
Monitor Salesforce Process Builder scheduled actions or Time-based rule:
Goto Setup -> Flows -> Paused and Waiting Interviews
Monitor Salesforce Workflow Rule scheduled actions or Time-based rule:
Setup -> Monitoring -> Time-Based Workflow
Reference: https://theblogreaders.com/monitor-salesforce-process-builder-scheduled-actions/
Salesforce Developer Tips:-
Salesforce Developer Tips #1
How to add minutes using Salesforce Apex Class:
Use addMinutes Apex Method in your apex class or trigger to add or subtract to your date time field.
For Example:-
Reminder_Date__c is a custom date time field, if you like to add 10mins in your current results then use like below:
to add 10mins or subtract 10 mins using apex class or apex trigger (12/09/2019 2:20 AM)
thisTask.Reminder_Date_Email__c = thisTask.ReminderDateTime.addMinutes(10); // to add 10 mins from your current value Result: 12/09/2019 2:30 AM
thisTask.Reminder_Date_Email__c = thisTask.ReminderDateTime.addMinutes(-10); // to subtract 10 mins from your current value Result: 12/09/2019 2:10 AM
DateTime currentTime = System.now().addMinutes(10); //to add 10 mins from current date time value
Reference For DateTime Apex Class Methods: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_datetime.htm
Salesforce Developer Tips #2
How to get logged in User Email value without using SOQL in Salesforce Apex Class:
Use UserInfo Apex Class Methods to get the logged in user Email Value or Firstname, Lastname, OrganizationID, ProfileID, UserID, etc
Example:
thisTask.Reminder_Email__c = UserInfo.getUserEmail();
For more infor about UserInfo Apex Class – https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_userinfo.htm
Salesforce Developer Tips #3
Disable Salesforce Browser Cache to help developer to hit hard refresh multiple time to reflect their changes in Salesforce Lightning UI:
Goto Setup -> Find “Session Settings” -> Under Cache Section -> Uptick the ““Enable secure and persistent browser caching to improve performance” option
Refer the How to Disable Browser Cache During AURA, Lightning Web Component Development blog post – https://theblogreaders.com/disable-browser-cache-aura-lightning-web-component-development/