ProcessSubmitRequest Class

Use the ProcessSubmitRequest class to submit a record for approval.

Namespace

Approval

Usage

You must specify the Approval namespace when creating an instance of this class. The constructor for this class takes no arguments. For example:

Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();

Inherited Methods

In addition to the methods listed, the ProcessSubmitRequest class has access to all the methods in its parent class, ProcessRequest Class.

Example

To view sample code, refer to Approval Processing Example.

ProcessSubmitRequest Methods

The following are methods for ProcessSubmitRequest. All are instance methods.

getObjectId()

Returns the ID of the record that has been submitted for approval. For example, it can return an account, contact, or custom object record.

Signature

public String getObjectId()

Return Value

Type: String

getProcessDefinitionNameOrId()

Returns the developer name or ID of the process definition.

Signature

public String getProcessDefinitionNameOrId()

Return Value

Type: String

Usage

The default is null. If the return value is null, when a user submits a record for approval Salesforce evaluates the entry criteria for all processes applicable to the user.

getSkipEntryCriteria()

If getProcessDefinitionNameOrId() returns a value other than null, getSkipEntryCriteria() determines whether to evaluate the entry criteria for the process (true) or not (false).

Signature

public Boolean getSkipEntryCriteria()

Return Value

Type: Boolean

getSubmitterId()

Returns the user ID of the submitter requesting the approval record. The user must be one of the allowed submitters in the process definition setup.

Signature

public String getSubmitterId()

Return Value

Type: String

setObjectId(recordId)

Sets the ID of the record to be submitted for approval. For example, it can specify an account, contact, or custom object record.

Signature

public Void setObjectId(String recordId)

Parameters

recordId
Type: String

Return Value

Type: Void

setProcessDefinitionNameOrId(nameOrId)

Sets the developer name or ID of the process definition to be evaluated.

Signature

public Void setProcessDefinitionNameOrId(String nameOrId)

Parameters

nameOrId
Type: String
The process definition developer name or process definition ID. The record is submitted to this specific process. If set to null, submission of a record approval follows standard evaluation; that is, every entry criteria of the process definition in the process order is evaluated and the one that satisfies is picked and submitted.

Return Value

Type: Void

Usage

If the process definition name or ID is not set via this method, then by default it is null. If it is null, the submission of a record for approval evaluates entry criteria for all processes applicable to the submitter. The order of evaluation is based on the process order of the setup.

setSkipEntryCriteria(skipEntryCriteria)

If the process definition name or ID is not null, setSkipEntryCriteria() determines whether to evaluate the entry criteria for the process (true) or not (false).

Signature

public Void setSkipEntryCriteria(Boolean skipEntryCriteria)

Parameters

skipEntryCriteria
Type: Boolean
If set to true, request submission skips the evaluation of entry criteria for the process set in setProcessDefinitionNameOrId(nameOrId). If the process definition name or ID is not specified, this parameter is ignored and standard evaluation is followed based on process order. If set to false, or if this method isn’t called, the entry criteria is not skipped.

Return Value

Type: Void

setSubmitterId(userID)

Sets the user ID of the submitter requesting the approval record. The user must be one of the allowed submitters in the process definition setup. If you don’t set a submitter ID, the process uses the current user as the submitter.

Signature

public Void setSubmitterId(String userID)

Parameters

userID
Type: String
The user ID on behalf of which the record is submitted. If set to null, the current user is the submitter. If the submitter is not set with this method, the default submitter is null (the current user).

Return Value

Type: Void