The following Apex method can be used create a new document via custom coding. Please be aware this method requires knowledge of Force.com best practices and as always we suggest testing your code in the Sandbox.
Syntax:
AssignmentRulesService.processRule(
@ruleId,
@listOfRecordIds
);
Parameters:
@ruleId
Required. The Assignment Rule Set Id to be used for processing the source record for predefined assignment actions.
@listOfRecordIds
Required. The list of Id value of the base object's source records for which Assignment Rule Set should be processed for.
Result:
The function call will return a JSON formatted string in this format: {success:"",result:""}
success
Will be either TRUE or FALSE
result
A confirmation text of completion OR error text if the process is halted by an unexpected error.
Example:
AssignmentRulesService.processRule(
'a0b9000000RJhKT',
new list<Id> {'a0d9000000GTrsg', 'a0d9000000GTrqa'}
);