Posts

Access Case by Lightning Platform User License Types (Using Flow) - Salesforce

Image
  In this article, we will discuss an interesting scenario that I recently came across and wanted to share the solution with the community. Scenario: Mickey Poulton is a Customer Care Representative who only handles the customer-related cases posted on his company's website. His day begins by looking at the open case(s) list, speaking to the customers, and closing it. Other than this activity he has nothing to do with any of the functionalities in the Salesforce CRM.  Constraints: Since Mickey is just taking care of a section of cases, his company's Salesforce Admin assigned a Salesforce Platform license to him. Problem: If you (Salesforce Admin/ Developer) assign any Lightning Platform User License Types to the user(s) which includes Salesforce Platform/ Force.com App Subscription licenses, the user(s) will not be able to access the Case object. Solution: You might choose a custom development approach using LWC/ Aura, to fix this problem. But....but..... There is a sm...

Customize File Downloads - Salesforce

Image
Hi Salesforce Ohana, In this article, we will discuss on how to customize file downloads in Salesforce. What are we going to cover? Scenario Blocks in the Standard/ declarative approach How to Customize File Downloads using Apex Customize File Downloads - Flow Execution Coding Time File Download Restriction Error Handling Flow Testing Time Limitations Scenario : Imagine a scenario where you/ any user(s) uploaded a file in Salesforce and restrict the downloading of the files because of various reasons like security, device factors (Block file download in mobile for Community Users), block downloads when the file already got downloaded more than 3 times, Apply IRM etc. Blocks in the Standard/ declarative approach : There is a place in Salesforce where you can control how various file types are handled during upload and download to provide more security but it is organization-level based on file types and it has many limitations. Where to find? Quick Find > File Upload and Download Sec...

Execute Apex Test Classes using Apex - Salesforce

Image
Hi Salesforce Ohana, In this article, we will discuss on 'How to execute Apex Test Class(es) using Apex in Salesforce' Before we jump into that, let's see what are the ways we generally use to run the Apex Test Classes  Run Test in the Apex Test Class in the Developer Console Test > New Run > Select the Test Classes to execute in the Developer Console Quick Find > Apex Test Execution > Select Test Classes > Run Execute the Test Classes in VS Code IDE or Code Builder Now, let's get into our thing. You can make use of the below Objects to Run/ Execute Apex Classes using Apex and extract the results of the test. ApexTestQueueItem - You can insert an ApexTestQueueItem object to place its corresponding Apex class in the Apex job queue for execution. The Apex job executes the test methods in the Apex Test Class. [ Ref ] ApexTestResult - You can query the fields of the ApexTestResult record that corresponds to a test method executed as part of an Apex class ex...

Week | Quarter | Year Calculation using Apex | Aura

 Calculation of current week number, quarter number, and year. Below is an apex code to calculate those details. Week Number : Integer daysSince1900_01_07 = Date.newInstance(1900, 1, 7).daysBetween(system.today()); Integer dayNumber = Math.mod(daysSince1900_01_07, 7) + 1;   Date dateForYear = system.today().addDays(Math.mod(8 - dayNumber, 7) - 3); Integer yearNum = dateForYear.year(); Date year_01_01 = Date.newInstance(yearNum, 1, 1);        Integer weekNum = (Integer)Math.floor((year_01_01.daysBetween(system.today())                                             + Math.mod((Math.mod(Date.newInstance(1900, 1,                                      7).daysBetween(year_01_01), 7) + 1) + 1, 7) - 3) / 7 + 1); System.debug('Current Week Number is :::'+wee...

Merge fields in Lightning Email Template's Subject

Scenario : Is there any possibility to use merge fields in Subject while creating Lightning Email Templates ? Solution : Yes, you can! Use the merge fields as {{{objectname.fieldname}}} in the subject. Example : Post Delivered for {{{Account.Name}}} -----> Subject End Result : Post Delivered for Tom Berry ---------> Subject Note : Merge fields are not yet available for Contact and Lead objects (this is on Salesforce’s roadmap). Hope it helps !!! Stay tuned for more sfdc blogs :)