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:
-
Open the Scheduled Jobs page.
Use the following URL
https://login.salesforce.com/apex/ONB2__JobsSetup
, or, if you are already logged in, appendapex/ONB2__JobsSetup
to your org's domain name.You can access the Scheduled Jobs page via the JustOn configuration app ( > JustOn Configuration > Jobs Setup).
-
From the
Apex Job
drop-down list, selectVAT Validation Job
.The
Job Name
field is automatically set toBatchVATValidationJob
. -
From the
Start Time
drop-down list, select the preferred execution time. - Optionally, edit the displayed cron expression to adjust the execution time.
-
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
orON_VATNumber
) must not be empty.
Info
From the Scheduled Jobs page, you can also run the job immediately.
Via Salesforce's Schedule Apex functionality:
-
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.
-
Click Schedule Apex on top of the list.
-
Specify the details as required.
- Job Name:
VATValidationChain
- Apex Class:
VATValidationChain
- Frequency:
Weekly
orMonthly
(with an according weekday or day of month setting) - Start
- End
- Preferred Start Time
- Job Name:
-
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
orON_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')
);