Loading
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
          Programmatic Job Invocation (Managed Package)

          Programmatic Job Invocation (Managed Package)

          For the managed package runtime, use VlocityBatchFramework methods to start scheduled jobs with a Data Source Type of Query. You can start all jobs, multiple jobs, or a single job. You can also invoke an Integration Procedure or VlocityOpenInterface as a job.

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

          To start all scheduled jobs with a Data Source Type of Query immediately, invoke the VlocityBatchFramework.startScheduledJobs() method using anonymous Apex, omitting any parameters, as follows:

          VlocityBatchFramework.startScheduledJobs();

          To start a single scheduled job with a Data Source Type of Query immediately, invoke the VlocityBatchFramework.startScheduledJob() method using anonymous Apex, specifying the ID for the job you want to run. For example:

          VlocityBatchFramework.startScheduledJob('a3Zf4000000J81v');

          To start multiple scheduled jobs with a Data Source Type of Query immediately, invoke the VlocityBatchFramework.startScheduledJobs() method using anonymous Apex, specifying a list of IDs for the jobs that you want to run. For example:

          VlocityBatchFramework.startScheduledJobs(new List<Id>{'a3Zf4000000J81v', 'a3Zf4000000IwIU'});

          Note
          Note The batch framework doesn't support invocation of scheduled jobs with Data Source Type values of No Input, Data Input, or List Input.

          The batch framework also enables you to programmatically invoke any Integration Procedure or VlocityOpenInterface as a job. The methods for starting batch jobs are as follows:

          VlocityBatchFramework.startIntegrationProcedureBatch(String integrationProcedureKey, List<Object> input, new Map<String, Object> options);
          VlocityBatchFramework.startOpenInterfaceBatch(String classMethod, List<Object> input, new Map<String, Object> options);

          To start an Integration Procedure job from Apex, issue the following command:

          VlocityBatchFramework.startIntegrationProcedureBatch({integration procedure key}, input list, options map);

          For example:

          VlocityBatchFramework.startIntegrationProcedureBatch('VlocityBatchFramework_ValidateAccountBillingStreet', accounts, new Map<String, Object>{'isInputAsList' => true, 'batchSize' => 20});

          To start an asynchronous Apex job that runs the invokeMethod of a specified class, issue the following command:

          VlocityBatchFramework.startOpenInterfaceBatch({ Class name . method name }, input list, options map);

          For example:

          VlocityBatchFramework.startOpenInterfaceBatch('VlocityBatchFrameworkTestOI4.updateStatus', accounts, new Map<String, Object>{'isInputAsList' => false, 'batchSize' => 20});

          To chain scheduled jobs that run Integration Procedures, provide the IDs of the jobs and include a chainable option that is set to true:

          startScheduledJobs(new Map<String, Object>{‘vlocityScheduledJobIds’ => new List<String>{‘JobId’, 'JobId2'}, new Map<String, Object>{'chainable' => true});

          For example:

          VlocityBatchFramework.startScheduledJobs(new Map<String, Object>{'vlocityScheduledJobIds' => new List<String>{'a3Zf4000000T7A1', 'a3Zf4000000T7A6'}}, new Map<String, Object>{'chainable' => true});

          You can specify the following options in the options map when invoking a job programatically. See above for details.

          • batchSize

          • chainable: Only jobs containing Integration Procedures are chainable.

          • isInputAsList

          • jobQueue

          The following methods enable you to manage job execution programmatically:

          • getCurrentBatchJobs(): Returns AsyncApexJobs that are not "Aborted", "Completed", or "Failed".

          • abortBatchJobs(): Aborts all AsyncApexJobs named "VlocityBatchFramework".

          • getScheduledBatchJob(): Returns a CronTrigger named "VlocityScheduledJob".

          • abortScheduledBatchJob(): Tries to abort the CronTrigger named "VlocityScheduledJob".

           
          Loading
          Salesforce Help | Article