Global API
Code Examples

Future vs Immediate

2min

Future method is for when large or multiple records are created. The code will run in the "Future" and it queues the request. This is used when you have more than one update occurring, such as when you have a header record with child records. eg. Sales Order with Sales Order Transaction Items. The first example below shows the @future callout, and does not have a response section of invokable fields.

Immediate, allows only single record creation. However it also allows passing of return values such as the NetSuite API Response. The second example below shows the @future method commented out, and the addition of Response invokable fields. You'll also notice the response is "wrapped" so it properly passes between objects. Note the inclusion of "List <Results>" instead of "void" and the methods both have return statements. The Response invokable values then become avaiable in the "Advanced" section of the apex action in flow, and you can set variables with the values passed back from apex.

Code Example: Future Method

Apex


Code Example: Immediate with Debug Values

Apex