How to automate custom logic on JustOn objects?
Your business may require to set custom data on JustOn records like invoices or subscriptions, or to start follow-up operations when these records change.
To this end, do not implement custom Apex triggers on JustOn objects. Use flows or the built-in JustOn mechanisms instead.
Note
JustOn runs its own triggers and batch processes on its objects, in part as a security mechanism that protects billing-relevant data. Custom Apex triggers on these objects may interfere with the standard processes, which may cause, for example,
- an unexpected execution order or recursive execution,
- exceeded governor limits within batch chains,
- failing bulk operations like the invoice run or the dunning run,
- unexpected behavior after a JustOn upgrade.
The resulting errors are usually hard to reproduce and to support.
This applies to JustOn objects only. Triggers on your own custom objects or on standard Salesforce objects are not affected.
Depending on your use case, use one of the following options instead.
| Use Case | Recommended Option |
|---|---|
| Setting custom data on subscriptions, items, invoices or invoice line items | Use the ON Field Mechanism: You define custom fields whose API names start with ON_ on the source objects, and JustOn copies their values to the target records during the subscription build or the invoice run. |
| Determining the values to be copied, or starting your own follow-up processes | Set up record-triggered flows on your own custom objects or on the standard Salesforce objects that serve as billing sources. |
| Starting JustOn operations when certain conditions become true | Set up record-triggered flows that call the invocable Apex classes supplied by JustOn – see, for example, Enabling Automatic Finalization With Flow, Enabling Automatic Cancellation With Flow or Enabling Event-Based Invoice Creation. |
For an overview of the operations that JustOn supports out of the box, see Which operations can be automated?.
Info
If your use case seems to require a trigger on a JustOn object, contact JustOn Support before implementing it – there may be a supported alternative.
Creating JustOn records in Apex test classes is a separate matter, see How to allow creating invoices for testing purposes?.