The Most Awaited Feature “List Contains” is Now Available – Spring’18

Yes, you heard it right! Now no more replicating List to Set. You can directly use contains over List. Salesforce Spring ’18 Release contains(listElement): Same as a set, it will return true if a list contains an element. List<String> listStrings = new List<String>(); listStrings.add(“One”); listStrings.add(“Two”); listStrings.add(“Three”); listStrings.add(“Four”); System.debug(‘Check Contains Four–>’+ listStrings.contains(‘Four’)); Output: Check Contains Four–>True…

Read More

Salesforce Test Utility Classes | TestDataFactory | Util Test in salesforce

Test utility classes are public test classes that contain reusable code for test data creation. The TestDataFactory/ TestUtility class is a special type of class — It is a public class that is annotated with @isTestand as such, are excluded from the organization code size limit and execute in test thisContext and can be accessed only from a running…

Read More

How to get a chatter “sharing via link” URL?

How to get a chatter “sharing via link” URL which can be accessed by anyone inside or outside of your company? This can be achieved from the field “DistributionPublicUrl” in “ContentDistribution” object. Step1:  Get the document ID from the object  “ContentDocument”. SELECT FileExtension,FileType,Id,IsArchived,IsDeleted,PublishStatus, SharingOption,SharingPrivacy,Title FROM ContentDocument where Id = ‘0694D0000008Ub4QAE’ Step2: Pass the ContentDocumentId value to…

Read More

System.VisualforceException: Getting content from within triggers is currently not supported

System.VisualforceException: Getting content from within triggers is currently not supported (Salesforce Visualforce Error Notification) —————————- Hi All, Recently I was working on a task in which we need to save a pdf page as an attachment when a new record(Contact) is inserted. I was doing it with Trigger and its handler using Pag reference Method…

Read More