action.skip

Scheduling VAT Validation

You can set up a job in order to have VAT numbers validated automatically on a regular basis.

Info

JustOn Billing & Invoice Management will partition the job according to the VAT Validation custom setting: it will process the number of accounts as defined in Batch Size and will automatically reschedule new jobs after the time specified in Delay Minutes until all accounts to be validated have been processed.

To schedule the VAT validation, you can use either JustOn's Scheduled Jobs page, Salesforce's Schedule Apex functionality or the Salesforce Developer Console. For details, see Scheduling a Job.

Via JustOn's Scheduled Jobs page:

  1. Open the Scheduled Jobs page.

    Use the following URL https://login.salesforce.com/apex/ONB2__JobsSetup, or, if you are already logged in, append apex/ONB2__JobsSetup to your org's domain name.

    You can access the Scheduled Jobs page via the JustOn configuration app ( > JustOn Configuration > Jobs Setup).

  2. From the Apex Job drop-down list, select VAT Validation Job.

    The Job Name field is automatically set to BatchVATValidationJob.

  3. From the Start Time drop-down list, select the preferred execution time.

  4. Optionally, edit the displayed cron expression to adjust the execution time.
  5. Click Schedule.

    This sets up the VAT validation to be executed at the specified time. For accounts to be considered by the job, the VAT number source field (VATIN or ON_VATNumber) must not be empty.

Info

From the Scheduled Jobs page, you can also run the job immediately.

Via Salesforce's Schedule Apex functionality:

  1. Click to enter Setup, then open Apex Classes.

    In Salesforce Lightning, navigate to Custom Code > Apex Classes.

    In Salesforce Classic, navigate to Develop > Apex Classes.

  2. Click Schedule Apex on top of the list.

  3. Specify the details as required.

    • Job Name: VATValidationChain
    • Apex Class: VATValidationChain
    • Frequency: Weekly or Monthly (with an according weekday or day of month setting)
    • Start
    • End
    • Preferred Start Time
  4. Click Save.

    This sets up the VAT validation to be executed at the specified time. For accounts to be considered by the job, the VAT number source field (VATIN or ON_VATNumber) must not be empty.

For more details about job scheduling, see Scheduling a Job in the JustOn documentation and Schedule Apex in the Salesforce Help.

You can also invoke the VAT validation using the following code in the Salesforce Developer Console:

new ONB2.ChainRunner()
.execute(
    new ONB2.ChainFactory().getByName('VATValidationChain')
);