This API creates an ad hoc approval step. This API accepts Context Request ID and creates an approval step for it. 

createAdhocApprovalwebService static Boolean createAdhocApproval(Id contextRequestId, String stepLabel, String assigneeType, Id assigneeId, String submissionComment, String relativeLocationToContext, List dependsOnContextRequestIdList, List dependsOnMeContextRequestIdList, Boolean sendEmail, Boolean notifyOnly)


Request Parameters
contextRequestIdIDYesID of the context request in relation to which you want to create an approval step.
stepLabelStringYesText label of the step

Type of the assignee. Assignee can be:

  • User
  • Role
  • Related User
  • Queue
assigneeIDIDYesID of the assignee.
submissionCommentStringYesComments for approval submission.

Relative location can be:

  • Before
  • After
  • In parallel
dependsOnContextRequestIdListList<ID>YesList of request identifiers that the ad hoc approval depends on.
dependsOnMeContextRequestIdListList<ID>YesList of request identifiers that depend on this ad hoc approval.
sendEmailBooleanNoSet it as true to send an email request. The default value is true.
notifyOnlyBooleanNoThe default value is false.
Response Parameter
resultBooleanThe API returns true when the ad hoc approval is created.