Skip to main content

Posts

Rest Integration Test using Postmaster - OAuth 2.0

Hi , So you have created a Rest class and exposed it. At this stage you know how you can test this using Workbench. Ex: If your class name is : getAccountDetails which is expecting 2 parameters. then in the workbench, you will go to rest Explorer and select Get/Post based on the requirement and paste the URL something similar to this. /services/apexrest/CKDomain/getAccountDetails?Param1=1100055515&Param2=13706195 And BAM!!!! Everything looks fine. But in real time scenarios, you might want to give this endpoint URL to some other system (Say SAP/Oracle) and you want to test from your end before informing them about the endpoint URL. So how can we achieve this. There are many ways to test this and I prefer using Postman app for this. Install  Postman  from here. Now , In order to successfully receive a Rest call out from Other system to Salesforce , there are multiple auth techniques. I would like to use the most commonly used auth technique - OAuth 2.0 As per my k
Recent posts

Lightning Events - Component Events

Hey Guys , In my previous post we have seen how to pass value from Parent to Child. Now lets see how you can pass value from Child to parent. Lightning Event :  There are 2 types events and they are ' COMPONENT ' and ' APPLICATION ' event. 1st we will see how COMPONENT event works and here we will reuse the same components which you created in previous blog. Think like this. There is a child component(ChildComp1_PC1) which updates some value and you need that updated value in the parent component(ParentComp1).                 You are gonna remember these steps,         Step 1: Create an event        Step 2: Register that event in component (in our scenario we will register in child comp).        Step 3: When the event is fired, have a logic to capture that event. so first you will create an event and register that in a child component (cause it is the one who is going to fire in order to send some values to it's parent ) so registering the event

Lightning - Passing value from Parent Component to Child Component

Hey Guys, This post I will try to cover some of the basics of Lightning Event. So if you have reached this post, I am assuming you have got some basic knowledge of Lightning framework. So, In brief Lightning Framework (LF ) works based on component and event driven modal. So when I say component  based, you might have seen that most of the codes are broken in to component in lightning development. You will understand more when you start creating one. There are few scenarios I would like to explain. Scene 1: Parent Component has one child and i want to pass some value from Parent to it's Child. Scene 2:Vice Versa Now .  I want to pass some value from Child Comp to it's parent components. How will you do ? There are 2 ways For Scene 1 and they are Way 1. Passing the value as Attribute Way 2. Sending the values using Lightning Methods. Way 1 is pretty simple. You will create a Attribute inside component 2(Child Comp) and will pass the required va

Public RESTful Web Services

Hey Guys, So this post will focus on how one can invoke any web service class( REST / SOAP ) without using any Authentication/Username & Password. Of course, people who are working on Public domains will understand why we need to web services without any authentication. Simple Example: There is a Data sitting in your org (say SFDC ) which is not harmfull if exposed to any requester. ( Examples of such Public Web services are UBER, google Maps). IMPORTANT : You must have created your own site. Now as a demo you will visit my website built on force.com Site and fill in the form. Once you land on the page, click Rest Example Tab. Lets hit this. later you will click this link appending the same Email id which you gave to create the record. once you click the above link, paste the email id at the end of the URL in the browser. You just hit a public Restful web-service. You created a record in someone's anonymous site and checked how many records you actually c

Game Changer - A Profile Changer App

Hey Everyone,  Thanks for coming up here. Please follow this link to know more on my Project. About App : In a Large / Medium sized orgs, having a wrong profiles could affect the business very badly. Plus, annoying a SFDC admin to get the required profile access would be time consuming as well as it would become difficult to track. This app is the solution for the above sample scenario. Just a Sample Scenario!!! : In a large scale org, one wants to have a System Admin/Equivalent or any profile access for the upcoming release. All they want to do is follow 3 steps and the request will be placed in next available batch with access grant date defined in the release record. This release record is placed in Custom Metadata obj and this is the only place your company’s system admin will act up on. Rest all is completely independent.

Salesforce to Salesforce Integration using OAuth 2.0 and Named Credentials

Hello Everyone, After investing lot of time, I was able to Integrate with my own sandbox( you can say one Salesforce Instance to Other Salesforce instance ) I had a scenario where i had to call a rest method created and Exposed in my own sandbox. So I started digging on this as you guys are now. In order to perform OAuth with salesforce you need to perform 3 important steps. 1.        Create Connected App 2.        Create Auth. Provider 3.        Create Named Credentials Once you are authorized, you just need to write 5- 6 lines of code to invoke your REST method. So let’s gets started. As you know  Salesforce uses OAuth 2.0 now. So our job is to set up OAuth. Importantly, OAuth requires 4 important details and they are, Client ID, Secrete Key, User Name and Password. So how do we get them? Client ID and Secrete Key (AKA Client Secrete) can be obtained from Creating a Connected app. But what about User Name and Password?? User Name and Password can

Salesforce - Invoke Apex from Visual Flows

This post will brief you about how one can invoke an Apex class from Visual Flows. Important Note: The method which you would like to invoke should be marked as  @InvocableMethod  and the variables which you would like use in and out of Flow, we need to mark them as  @InvocableVariable Best Practices : Make 2 wrapper classes. One for getting the values from Flow to Apex and other wrapper class is to get the values from Apex to Flow. The below sample code explains how you can get a detail in and out of the flow. Use Case : We ask user to enter the Account ID which they want to update and New Name which they want to update on the entered Account ID. Note: Since this is for the demo purpose, we are asking user to enter the Account ID (SFDC 15/18 digit ID ). In Ideal scenario we can invoke the Flow from custom button/links. (  Refer This ) Here we created a Small Visual Flow which has 2 screens ( 1. For asking details from user and other for Showing the success/fa