Loading
Salesforce now sends email only from verified domains. Read More
Help Agent Performance DegradationRead More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Integration Procedure Unit Testing from Apex

          Integration Procedure Unit Testing from Apex

          You can set up a test class in Apex and use it to call and test an Integration Procedure. In the core runtime, HTTP mocking isn’t possible, and real HTTP calls occur during test execution.

          The following is an example unit test of an Integration Procedure:

          @isTest(seeAllData=true)
          global with sharing class TestVlocityIntergationProcedure
          {
              static testMethod void testVip()
              {
                  Map<String, Object> inputMap = new Map<String, Object>();
          inputMap.put('AccountName', 'Vlocity');
                  ConnectAPI.IntegrationProcedureServiceRunInputRepresentation apexInput = new ConnectAPI.IntegrationProcedureServiceRunInputRepresentation();
          
                  ConnectAPI.IntegrationProcedureServiceRunOutputRepresentation output = ConnectAPI.OmniDesignerConnect.integrationProcedureExecute('Type_Subtype', apexInput); 
                  List<String> stringList = new List<String>();
                  String serializedInputMap = JSON.serialize(inputMap);
                  stringList.add(serializedInputMap);
                  apexInput.input = stringList;
          
                  ConnectAPI.IntegrationProcedureServiceRunOutputRepresentation output = ConnectAPI.OmniDesignerConnect.integrationProcedureExecute('Type_Subtype', apexInput); 
                  List<String> responseList = output.response;
                  String currentSerResponse = responseList[0];
                  Map<String, Object> currentResponseObj = (Map<String, Object>)JSON.deserializeUntyped(currentSerResponse);
          
                  Object response = currentResponseObj.get('result');
                  System.assertEquals('joe@vlocity.com', response.get('ContactEmail'));
              }
          }   

          Note these features of the example:

          • You must use Salesforce's seeAllData property on the @isTest annotation. This ensures that the unit test sees the Vlocity SObject data in the org.

          • Use the ConnectAPI.OmniDesignerConnect.integrationProcedureExecute() Connect API to run the Integration Procedure.

          • The namespace is vlocity_cmt, vlocity_ins, or vlocity_ps.

          • The Type_Subtype parameter specifies the Integration Procedure to test.

           
          Loading
          Salesforce Help | Article