Posts

Showing posts with the label Salesforce

REST apex code fetch the API usage

Image
  Apex code fetch the API usage

API Usage Notifications

Image
 API Usage Notifications With this feature admins will receive an notification whenever an organisation exceeds a limit for the number of API requests made in a specified span of hours. Permission needed: Modify All Data Steps to Create an API Notification Login to Salesforce Go to Setup, and in quick find search and select "API Usage Notification" Click on New and enter the details 1. Notification Recipient: User who will receive the notification 2. Threshold: percentage of the rate limit, once exceeded in time interval, notification will flow to the recipient 3. Notification Interval (Hours): The time for which the number of requests is measured, in hours. Note: If you change the time period, the new time period does not take effect until after the next notification of the existing time period. For example, assume you have set the time period to send notifications every hour. Then at 4:05 p.m., you set the time period to send notifications every 24 hours. A last notificati...
Image
Asynchronous Apex Triggers In Summer 19 release Salesforce introduce a new feature to process data using a combination of 'Asynchronous Apex Triggers' and Change Data Capture. Any DML on Salesforce records causes platform to start a series of calculations, run business logic and database updates, all these are called as an Apex Transactions. You can reduce the Apex transaction time to complete the business logic and limit constraints by decoupling resource-intensive, non-transactional logic from database transaction and execute asynchronously.  Asynchronous Apex triggers are change event triggers that run asynchronously after a database transaction is completed. They are ‘after-insert’ triggers and can be defined with the after insert keywords. They can be created the same way we create regular Apex triggers. You set the trigger to use a change event object instead of an sObject. The change event object name is suffixed with ChangeEvent. For example, Account change e...
Image
lightning:map component lightning:map introduced in winter 19 which can be use display a map of one or more locations using Google Maps. We can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street. This component requires API version 44.0 and later. lightning:map has required attribute mapMarkers which accepts array of markers that indicate location. A market contains Location information:  This can be a coordinate pair of latitude and longitude, or an address composed of address elements. Descriptive information:  This is information like title, description and an icon which is information relevant to the marker but not specifically related to location. Example Create a new Object called 'Tower' with two new custom fields 1. Field Label: State     Type: Master-Detail (Account) 2. Field Label: Locati...
Image
Inherited Sharing in Apex Inherited Sharing is available with Salesforce Winter'19 release. Use Inherited sharing keyword on apex class which allows the class to run in sharing mode of class that called it. Inherited sharing ensures that our apex code is not used in unexpected or insecure way. An Apex class with inherited sharing runs as with sharing when used as a Visualforce page controller, Apex REST service, or an entry point to an Apex transaction. If the class is used as the entry point to an Apex transaction, an omitted sharing declaration runs as without sharing. However, inherited sharing ensures that the default is to run as with sharing. A class declared as inherited sharing runs only as without sharing when explicitly called from an already established without sharing context. Example: We have declares Apex class with inherited sharing and a visualforce invocation of that Apex code. Because of the 'inherited sharing' declaration, only contacts for which...
Image
Connect Dropbox with Salesforce as IdP An identity provider is a system entity that creates, maintains, and manages identity information for principals while providing authentication services to relying applications. An identity provider is “a trusted provider that lets you use single sign-on (SSO) to access other websites". When you log into trailhead by clicking 'Log in with Facebook', 'Log in with Google+' or 'Log in with Linkedin' then that's the example of Google, Facebook, Linkedin acting as trusted identity provider, and authenticating you on behalf of trailhead. Identity provider saves your time spent in creating and maintaining your credentials and helping third party websites from storing and protecting your information. Salesforce supports   Identity provided-initiated login - when Salesforce logs in to a server provider at the initiation of the end user. Service provider-initiated login - when the service provider requests S...
Image
Reset Password button missing for Community Users If you are created a community user and you don't see 'Reset Password' button on user detail record then one of the reason of missing button is that you might not have added that user to community as member. Steps to add the Community User: 1. Go to Setup. 2. Search 'All Communities' in Quick Find. 3. Click on workspaces link next to community. 4. Click on Administration. 5. Select Members from left panel 6. Select the user's profile and click on Add.
Image
CAPTCHA in Lightning Use below code to implement captcha in your lightning component. Lightning_CAPTCH.cmp Lightning_CAPTCHController.js Lightning_CAPTCHHelper.js Add caption
Image
Pagination in Lightning In this blog we will implement pagination in Lightning.  PaginationController.cls LightningPagination.cmp LightningPaginationController.js LightningPaginationHelper.js
Image
instanceof in Apex If we need to verify at runtime whether an object is actually an instance of a particular class use instanceof keyword.  The  instanceof  keyword can only be used to verify if the target type in the expression on the right of the keyword is a viable alternative for the declared type of the expression on the left. You could have something which is passed as Object type and using instanceof you can determine if it is an instance of your class or other data types below code will help understand the use instanceof keyword. Open developer console and run below code and observe the logs InstanceofController.getType(new Account()); INstanceofController.getType(true); INstanceofController.getType(Id.valueOf('001xa000003DIlo')); InstanceofController.getType(Date.newInstance(2020, 12, 31)); InstanceofController.getType(DateTime.newInstance(2020, 12, 31,0,0,0)); InstanceofController.getType('Clever Fox'); InstanceofController.getType(Blob.valueo...