Welcome back! Are you ready for the final installment of our Data Migration series? Our final look will focus on testing after integrating data from external applications. If you haven’t had a chance to read the other posts in the series, no need to worry! To check out part 1, part 2, or part 3, click the links. All caught up? Let’s begin!
You have reached the testing phase of your data migration process: integrating data from external applications. It can feel hard to know where to begin, so let’s start with what to keep in mind. When coming into the testing process, you need to keep in mind that the external application might not be ready to send requests yet. Even if the external application is ready to send requests, you will still need to make sure the class you wrote is functional, working as expected and giving responses.
The first thing we recommend using is Workbench (https://workbench.developerforce.com). You can do this by logging in using your sandbox credentials and using the Utilities->REST explorer to test your class. Provide the URL that you registered on the class as the REST resource and POST method with the request JSON.
If the response you get is the expected one, then you are ready to proceed with the next step. If it is not, you will need to go back and modify the code and response wrapper then test again.
Although you have finished unit testing, it does not necessarily mean that the external application is ready to do a callout to the apex REST. In order to make sure it is, we recommend using the one of the following tools:
- SOAP UI desktop app
- Postman desktop app
- Advanced REST client extension on Chrome
In order to test in these tools, you will need the following information:
- Client ID: Get this from connected app
- Client Secret: Get this from connected app
- Authorization URI: <<your org URL>> /services/oauth2/authorize
- Access Token URI: <<your org URL>> /services/oauth2/token
- Redirect URI: Get this from connected app (this can be anything that you can define)
- Authentication type: OAuth2.0
- Login username and password: We recommend using Integration User as the User name so that you know the records are created or updated by integration User. This is also best practice.
Creating connected apps
You are now callout ready! Time to create connected apps. It is important to complete this step in your org to get the information from the previous sections. This can be done by going through the following sequence:
Build -> Create -> Establish Apps -> Connect Apps.
What comes after connected apps? Next you will need to create a REST project in SOAP UI (or another chosen tool) to get the access token. For this step only, you will need to enter the integration user credentials to Authenticate. You should now receive the access token. Until you get this you may not be able to get the response successfully. Next, send the POST request with JSP request and you should be receiving a response. Now the apex REST API information can be shared with the external team for their testing from either of these tools or from their application.
A couple of final points: This REST class can be used for real-time updates and system changes or to send requests to update or insert records. Lastly, when calling Salesforce, the external application may encounter security certificate issues that can be solved with the help of the network admin team from the caller.
You have now made it to the end of the data migration series! For more information visit the Statêra website.
About Bala Sadayappan
Bala is a technical architect in Statêra’s Salesforce CRM Practice. Bala has 18 years experience in IT as a technical lead/architect and maintains certifications in Salesforce.com (Administrator & Developer), Apttus Configure Price Quote (CPQ) and XAE.