Call Integration Procedure from Apex
ฝัง
- เผยแพร่เมื่อ 18 ต.ค. 2024
- In this video we will discuss about how we can call out Integration Procedure from Apex.
Github link for code snnippet: github.com/dip...
1:32 What is input,option and output in Integration Procedure
2:40 Lets configure our Apex class
7:31 Quick Summary and demo
9:32 Lets call another integration procedure from Apex
SF Documentation linke: help.salesforc...
#omnistudio #integrationprocedure #apex #omnistudiotutorial #salesforce #omniscript #flexcard #dataraptor #integrationprocedure #apex #editblock #vlocity #realtimeprojectcenters #omnistudiotraining #omniscriptdataraptor #omnistudiointegrationprocedure #omniscriptlookup #omnistudiolistaction #vlocity #omnistudiotutorial #vlocitytutorial #childflexcard #omniscriptblock #omnistudioflexcard #omnistudiochildflexcard #salesforcevlocity #salesforcevlocitytutorial #salesforceomnistudiotutorial #vlocitylwc
Great video. Easy to understand. Please continue to do more videos like this. My use case is I’m calling an IP from Apex and expose apex as a webservice so the external system can call the Apex URL. Have you done this before? Instead of exposing IP API directly, we wanted to use apex and call IP and trim the success/error response. Please let me know your thoughts.
Hi Raghav, It can be done same way how you write the apex rest web services and expose them as rest api endpoints. You just have to get the prameters from the body of your rest api call(which you sent from postman) and pass those parameters to the method created in the video.
The other way is (of course you said you know that) to call and integration procedure directly from postman.
I believe we can have 1 class to run various IPs in it and then we can pass IP name as parameter too. We can use Switch or If Else to figure out right IP to run and then run that piece of code. COrrect ?
Yes you can do that too.
Stay tuned for the next video in which I'm gonna call this method from another apex class and use that apex class directly inside omniscript by configuring remote action.
This is syncronus way of calling Integration procedure from Apex code. How can we call asynchronously?
You have to enable Queueable Chainable option in the integration procedure configuration
how to write test class for this?
Here is the code
@isTest (seeAllData=true)
private class RunIntegrationProcedureFromApexTest {
public static void createSampleData(){
// Create test Account
Account acc = new Account(Name = 'Test Account');
insert acc;
// Create test Contacts related to the Account
Contact[] contacts = new Contact[5];
for(Integer i = 0; i < 5; i++) {
contacts[i] = new Contact(
FirstName = 'Contact ' + i,
LastName = 'Test',
AccountId = acc.Id
);
}
insert contacts;
}
@isTest
static void testIntegrationProcedure() {
createSampleData();
List acc = [Select Id from Account where Name = 'Test Account'];
// Call the integration procedure
test.startTest();
Map result = RunIntegrationProcedureFromApex.callIntergrationprocedure(
acc[0].Id,
'', // Passing the first contact's first name
'demo_transformAccConDetails' // Replace 'YourProcedureName' with the actual procedure name
);
test.stopTest();
// Assertions
System.assertNotEquals(null, result, 'Result should not be null');
}
}