From the doc,
createRecordAsync(processType, mbObject)
Asynchronously creates case, lead, and custom object records. This method collects record creation requests and processes them in batches.
Signature
public static String createRecordAsync(String processType, SObject mbObject)
Parameters
processType
Type: String
The process you use to create records.
mbObject
Type: SObject
The records created for objects. Objects must be supported by the high-volume record creation.
Return Value
Type: String .
Returns the UUID for the record created
UPDATE:
I have these inputs from our product team:
Usecase:
The createRecordAsync method should be used in the context of large-scale B2C digital experiences (aka, communities, sites, networks) which require supporting high scale of creation of the most common objects like cases, leads and custom objects. In that case, an object created using this method will be created asynchronously, by first being collected into a batch, and then created in bulk together with other creation requests. This way of creation is much more efficient and hence can support much larger throughputs of object/min. An example of such could be a microsite that collects leads, and expects a huge influx of users signing up when campaign starts. For such usecase, using this method would allow a much higher scale of leads creation than having those lead requests created one at a time, when the user submits them.
Note: The below information is taken from the upcoming help doc which is expected to be live by early June (safe harbor). This is subject to change and should not be considered the source of truth.
Guest users can create five times as many cases, leads, and custom objects when they’re collected into batches and processed asynchronously rather than one at a time. Batch processing improves performance and keeps your site moving during heavy traffic spikes.
- From Setup, in the Quick Find box, enter Apex Classes, and then select Apex Classes.
- Use this function for the Apex controller that manages the object that you want to create.
String uuid = Network.createRecordAsync('GENERIC', mycase);
- The first parameter processType must be set to 'GENERIC'.
- The second parameter sObject can’t be empty or null. It must contain a valid value representing a supported object.
For example, to create cases in batches:
new Case(
mycase.Subject = 'sample case',
mycase.Description = 'case description');
Hope this helps!