Example (Managed Package)

For the managed package runtime, in the Troubleshooting Omniscript, the callOut1 Remote Action element calls an external system to check if the asset is still under warranty.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

This example references the Troubleshooting Omniscript and the OmniCallout and DataObjectService Apex classes. It implements the OmniCallout class and the checkWarrantyStatus method:

image

Since this is a sample Omniscript, the method contains a hard-coded response:

image

The callOut2 Remote Action calls the returnItemOrder method, which in turn calls the DataObjectService class that calls out to a Heroku instance to return an order number:

image

Sample Class Structure

The following class structure can be used to call out to an external system:

global with sharing class CustomClassName implements NS.VlocityOpenInterface
   {

    global CustomClassName() {}
			
    global Boolean invokeMethod(String methodName, Map<String,Object> inputMap, Map<String,Object> outMap, Map<String,Object> options) {
			
              Boolean result = true;
			
      try{
			
             if(methodName.equals('customMethodName')){
			
             // your implementation, use outMap to send response back to OmniScript                                                                  
			
            }
			
            } 
 
	else if(methodName.equals('customMethodName2')){
			
            // your implementation, use outMap to send response back to OmniScript                   
			
         }                              
			
      } catch(Exception e){
			           
         result = false;
			        
      }
			 
             return result;
			      
   }
			
}