Class WorkflowDTO.ApprovalStepDTO
- Enclosing class:
WorkflowDTO
WorkflowDTO.addApprovalStep(String).
The approvers are either users or user groups, not both. By default, one approval is enough; use
withMinApprovalsNeeded(int) or withMinApprovalsForGroups(Integer...) to require more.
Example:
workflow.addApprovalStep("Sales Manager")
.withApprovers("david.newman", "abhijit.gupta")
.withMinApprovalsNeeded(2)
.withReasons("Total Price is over threshold.")
- See Also:
-
Field Summary
Fields inherited from class WorkflowDTO.StepDTO
alreadySatisfiedComment, emailAttachment, emailAttachmentTemplateName, properties, uniqueName, workflow -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProperty(String name, Object value) Adds a custom property to the step.voidReturns the attachment references added bywithApprovalRequiredEmailAttachments(Object).Deprecated.Return the current approvers (or null if none set or if group approval)Returns the Condition Record logic set for this step.Returns all denial reasons defined for this approval stepReturns status if the submitter is excluded in case of group approvalReturns mandatory comments for this approval stepReturns the minimum number of approvers needed for each user group in this step.Returns the minimum number of approvers needed for this approval stepReturns the subset of approvers that should receive email notification.Returns the post step logic set for this step.Deprecated.UsegetReasons()instead.Returns the reasons textDeprecated.UsegetUserGroupApprovers()instead.Gets user group names in case of group approval (or null otherwise)booleanReturns whether the denial reasons are optional in this approval step.Returns whether a user who is a member of several approving groups can approve the step once for each group.Returns whether a single approval can approve for all of the user's groups at once.Deprecated.UsewithReasons(String...)instead.toMap()withApprovalRequiredEmailAttachment(Object attachment) Adds one attachment, or a filter selecting attachments, to the approval-required email of this step.withApprovalRequiredEmailAttachments(Object attachments) Adds attachments of the document to the approval-required email of this step.withApprover(String userLoginName) Deprecated.UsewithApprovers(String...)instead.withApprovers(String... userLoginNames) Sets the users who approve this step.withConditionRecordLogic(String logicUniqueName) Sets condition record logic name that should be run after final step is executed (i.e.withDenialReasons(List<String> denialReasons, boolean isDenialReasonOptional) Denial Reasons is a list of predefined text options, which will be presented to the approver, while denying the item.withExcludeSubmitter(boolean excludeSubmitter) Set exclude submitterwithMandatoryComments(String... actions) Makes comment mandatory for certain actions.withMinApprovalsForGroups(Integer... minApprovalsForGroups) A minimum number of approvals needed for each group, to consider this step as approved.withMinApprovalsNeeded(int minApprovalsNeeded) A minimum number of approvals needed to consider this step as approved.withMultipleApprovalByGroupsAllowed(boolean multipleApprovalByGroupsAllowed) Deprecated.UsewithSingleUserMultiApprovalAllowed(boolean)instead.withNotificationOnlyToUsers(String... userLoginNames) Subset of approvers that should receive the email notificationwithParallelStepApprovalAllowed(boolean parallelStepApprovalAllowed) Lets a user who is a member of several approving user groups approve for all of them with one action.withPostStepLogic(String logicUniqueName) Sets post step logic name that should be run after this step is executed (i.e.withReasons(String... reasons) Sets explanation reasons for approvers of the approval step.withSingleUserMultiApprovalAllowed(boolean multiApprovalAllowed) Lets a user who is a member of several approving user groups approve or deny the step separately on behalf of each of those groups.withUserGroupApprover(String userGroupUniqueName) Deprecated.UsewithUserGroupApprovers(String...)instead.withUserGroupApprover(String userGroupUniqueName, boolean excludeSubmitter) Deprecated.UsewithUserGroupApprovers(String...)together withwithExcludeSubmitter(boolean)instead.withUserGroupApprovers(String... userGroupUniqueNames) Sets the user groups whose members approve this step.Methods inherited from class WorkflowDTO.StepDTO
equals, getAlreadySatisfiedComment, getEmailAttachment, getEmailAttachmentTemplateName, getProperties, getUniqueName, hashCode, readSingleValue, withAlreadySatisfied, withAlreadySatisfied, withEmailAttachment, withEmailAttachment, withEmailAttachmentTemplateName
-
Constructor Details
-
ApprovalStepDTO
-
-
Method Details
-
withApprover
Deprecated.UsewithApprovers(String...)instead.Last invoked ofwithApprover(String),withUserGroupApprover(String)wins- Parameters:
userLoginName- The login name of the approver- Returns:
- The approval step itself.
-
withApprovers
Sets the users who approve this step. Last invoked ofwithApprovers(String...),withUserGroupApprovers(String...)winsBy default, the step is approved when one of the users approves it. The same user cannot approve the document more than once, except a Workflow Admin.
Example:
workflow.addApprovalStep("Sales Manager") .withApprovers("david.newman", "abhijit.gupta") .withReasons("Total Price is over threshold.")- Parameters:
userLoginNames- The login names of the approvers- Returns:
- The approval step itself.
- See Also:
-
withNotificationOnlyToUsers
Subset of approvers that should receive the email notificationTypically used when the step is assigned to a user group and only some of its members should be notified. The other approvers can still approve the step.
- Parameters:
userLoginNames- The login names of the users to notify- Returns:
- The approval step itself.
- See Also:
-
withUserGroupApprover
Deprecated.UsewithUserGroupApprovers(String...)instead.Last invoked ofwithApprover(String),withUserGroupApprover(String)wins- Parameters:
userGroupUniqueName- The unique name of the approving user group- Returns:
- The approval step itself.
-
withUserGroupApprovers
Sets the user groups whose members approve this step. Last invoked ofwithApprovers(String...),withUserGroupApprovers(String...)winsUse
withMinApprovalsForGroups(Integer...)to require a number of approvals from each group.Example:
workflow.addApprovalStep("Approval Step1") .withUserGroupApprovers("Sales Mgmt", "Regional Mgmt") .withMinApprovalsForGroups(1, 1)- Parameters:
userGroupUniqueNames- The unique names of the approving user groups- Returns:
- The approval step itself.
- See Also:
-
withUserGroupApprover
@Deprecated public WorkflowDTO.ApprovalStepDTO withUserGroupApprover(String userGroupUniqueName, boolean excludeSubmitter) Deprecated.UsewithUserGroupApprovers(String...)together withwithExcludeSubmitter(boolean)instead.Same aswithUserGroupApprover(String)but the submitter is excluded in case they are a member of the group Last invoked ofwithApprover(String),withUserGroupApprover(String)wins- Parameters:
userGroupUniqueName- The unique name of the approving user groupexcludeSubmitter-trueto exclude the submitter from approving- Returns:
- The approval step itself.
-
withExcludeSubmitter
Set exclude submitterWhen
true, the user who submitted the document cannot approve or deny this step, even as a member of an approving user group, and is not sent the group's approval notification.- Parameters:
excludeSubmitter-trueto exclude the submitter,falseotherwise- Returns:
- The approval step itself.
- See Also:
-
setReason
Deprecated.UsewithReasons(String...)instead.Set an explanation reason for the approval step.- Parameters:
reason- The reason- Returns:
- The approval step itself.
-
withReasons
Sets explanation reasons for approvers of the approval step.Example:
workflow.addApprovalStep("Approval Step1") .withApprovers("A1", "A2") .withReasons("Margin below 10%", "Discount above 20%")- Parameters:
reasons- The reasons why each approver needs to approve. The reasons match approvers, e.g. if you have 3 approvers (A1, A2, A3), you can specify up to 3 reasons (R1, R2, R3) and then reason R1 applies to approver A1, reason R2 applies to approver A2, etc. If you want to put multiple reasons to a single approver, you need to join the reason messages together into one string and provide such single combined reason for the approver.- Returns:
- The approval step itself.
- See Also:
-
addProperty
Adds a custom property to the step. The properties are stored with the workflow step.- Parameters:
name- The property namevalue- The property value- Returns:
- The approval step itself.
- See Also:
-
withApprovalRequiredEmailAttachment
Adds one attachment, or a filter selecting attachments, to the approval-required email of this step. Same aswithApprovalRequiredEmailAttachments(Object).- Parameters:
attachment- The attachment reference, seewithApprovalRequiredEmailAttachments(Object)- Returns:
- The approval step itself.
-
withApprovalRequiredEmailAttachments
Adds attachments of the document to the approval-required email of this step.Pass either the id, typedId or file name of one attachment of the document being approved, or a filter (a
Filteror an advanced-criteria map) that selects several of its attachments. References that match no attachment are ignored. The number of attachments (2 by default) and their total size are limited by the server configuration; exceeding a limit fails the workflow.Example:
workflow.addApprovalStep("Finance Approval") .withApprovers("Mary") .withApprovalRequiredEmailAttachments("pricing-summary.pdf")- Parameters:
attachments- The attachment reference or filter, as described above- Returns:
- The approval step itself.
- See Also:
-
getApprover
Deprecated.UsegetApprovers()instead.Return the current approver in case of single approver set (or null if none set or if group approval)- Returns:
- The user name
-
getApprovers
Return the current approvers (or null if none set or if group approval)- Returns:
- The user names
- See Also:
-
getNotificationOnlyToUsers
Returns the subset of approvers that should receive email notification.- Returns:
- The user names, or
nullif all approvers are notified - See Also:
-
getReason
Deprecated.UsegetReasons()instead.Returns the reason text- Returns:
- The reason
-
getReasons
Returns the reasons text- Returns:
- The reasons, or
nullif none were set - See Also:
-
getExcludeSubmitter
Returns status if the submitter is excluded in case of group approval- Returns:
- true if excluded;
nullif not set - See Also:
-
getUserGroupApprover
Deprecated.UsegetUserGroupApprovers()instead.Gets user group name in case of single group approval (or null otherwise)- Returns:
- The user group unique name as a
String, ornull
-
getUserGroupApprovers
Gets user group names in case of group approval (or null otherwise) -
withMinApprovalsNeeded
A minimum number of approvals needed to consider this step as approved. Default is 1For a step assigned to users, assign at least as many users as the number of approvals needed.
Example:
workflow.addApprovalStep("Sales Manager") .withApprovers("david.newman", "abhijit.gupta") .withMinApprovalsNeeded(2)- Parameters:
minApprovalsNeeded- The minimum number of distinct approvals- Returns:
- The approval step itself.
- See Also:
-
withMinApprovalsForGroups
A minimum number of approvals needed for each group, to consider this step as approved. Default is 0 for each group. IfwithMinApprovalsNeeded(int)is not set, the total number of approvals needed is the sum of these values.Example:
workflow.addApprovalStep("Approval Step1") .withUserGroupApprovers("Sales Mgmt", "Regional Mgmt") .withMinApprovalsForGroups(1, 2)- Parameters:
minApprovalsForGroups- The minimum number of approvals for each group, in the order of the groups passed towithUserGroupApprovers(String...)- Returns:
- The approval step itself.
- See Also:
-
withPostStepLogic
Sets post step logic name that should be run after this step is executed (i.e. Approved, Denied or Withdrawn)Example:
workflow.addApprovalStep("DefaultApproval") .withApprovers("user1") .withPostStepLogic("")- Parameters:
logicUniqueName- Workflow Post Step Logic unique name. If null,WorkflowDTO.withDefaultPostApprovalStepLogic(String)will be used, if empty string, no logic will be used even if there isWorkflowDTO.withDefaultPostApprovalStepLogic(String)set- Returns:
- The approval step itself.
- See Also:
-
getPostStepLogicName
Returns the post step logic set for this step.- Returns:
- The logic unique name; an empty
Stringif disabled,nullif the default logic applies - See Also:
-
withConditionRecordLogic
Sets condition record logic name that should be run after final step is executed (i.e. Approved or Denied) or after each approved contract recalculation.Example – Condition Record logic defined at the level of a specific step. This means that you can run specific CR logic on deny, approve, and different for certain WF steps:
workflow.addApprovalStep("DefaultApproval") .withApprovers("user1") .withConditionRecordLogic("ApprovalCRLogic") .withReasons("Standard approval")Example – disabling the default Condition Record logic by defining an empty string on the step:
Supported object types:workflow.addApprovalStep("DefaultApproval") .withApprovers("user1") .withConditionRecordLogic("") .withReasons("Standard approval")- quote
- pricegriditem
- calculationgriditem
- rebateagreement
- contract
- dcr
- pricelist
- rebaterecord
- modelrecord
- claim
- dealplan
- model
- customform
- compensation
- compensationrecord
- rebaterecordgroup
- Parameters:
logicUniqueName- Condition Record Logic unique name. If null,WorkflowDTO.withDefaultConditionRecordLogic(String)will be used, if empty string, no logic will be used, even if there isWorkflowDTO.withDefaultConditionRecordLogic(String)set.- Returns:
- The updated ApprovalStepDTO instance with the specified condition record logic.
- Since:
- 13.0 - Rampur
- See Also:
-
getConditionRecordLogicName
Returns the Condition Record logic set for this step.- Returns:
- The logic unique name; an empty
Stringif disabled,nullif the default logic applies - See Also:
-
getApprovalRequiredEmailAttachments
Returns the attachment references added bywithApprovalRequiredEmailAttachments(Object).- Returns:
- The attachment references and filters as a
List; empty if none were added - See Also:
-
toMap
- Overrides:
toMapin classWorkflowDTO.StepDTO<WorkflowDTO.ApprovalStepDTO>
-
fromMap
- Overrides:
fromMapin classWorkflowDTO.StepDTO<WorkflowDTO.ApprovalStepDTO>
-
withDenialReasons
public WorkflowDTO.ApprovalStepDTO withDenialReasons(List<String> denialReasons, boolean isDenialReasonOptional) Denial Reasons is a list of predefined text options, which will be presented to the approver, while denying the item. The user would be able to either select one of them, or alternatively write free text reason. Providing the denial reasons can be optional or mandatoryThe reasons are added to any reasons defined earlier for this step. The flag overrides the value inherited from
WorkflowDTO.withDenialReasons(List, boolean).Example:
workflow.addApprovalStep("step1") .withApprovers("admin") .withDenialReasons(["Price too low", "Missing information"], false)- Parameters:
denialReasons- Predefined workflow denial reasonsisDenialReasonOptional- False, if the denial reasons should be mandatory- Returns:
- The approval step itself.
- See Also:
-
getDenialReasons
Returns all denial reasons defined for this approval step -
isDenialReasonOptional
public boolean isDenialReasonOptional()Returns whether the denial reasons are optional in this approval step. If they're not optional, then they're mandatory- Returns:
trueif denial reasons are optional,falseif mandatory- See Also:
-
getMinApprovalsNeeded
Returns the minimum number of approvers needed for this approval step- Returns:
- The number set by
withMinApprovalsNeeded(int);nullif not set - See Also:
-
getMinApprovalsForGroups
Returns the minimum number of approvers needed for each user group in this step. The list is in the same order, in which is the list of Groups for this step -
isMultiApprovalAllowed
Returns whether a user who is a member of several approving groups can approve the step once for each group.- Returns:
- The value set by
withSingleUserMultiApprovalAllowed(boolean);nullif not set (not allowed) - See Also:
-
isParallelStepApprovalAllowed
Returns whether a single approval can approve for all of the user's groups at once.- Returns:
- The value set by
withParallelStepApprovalAllowed(boolean);nullif not set (not allowed) - See Also:
-
getMandatoryComments
Returns mandatory comments for this approval step- Returns:
- The actions (
"APPROVE","DENY") that require a comment;nullor empty if none - See Also:
-
withMultipleApprovalByGroupsAllowed
@Deprecated public WorkflowDTO.ApprovalStepDTO withMultipleApprovalByGroupsAllowed(boolean multipleApprovalByGroupsAllowed) Deprecated.UsewithSingleUserMultiApprovalAllowed(boolean)instead.- Parameters:
multipleApprovalByGroupsAllowed- When true, the user can approve the same step as many times as the group setting allows- Returns:
- The approval step itself.
-
withSingleUserMultiApprovalAllowed
Lets a user who is a member of several approving user groups approve or deny the step separately on behalf of each of those groups. By default, a user acts for one group only.Example:
workflow.addApprovalStep("Approval Step1") .withUserGroupApprovers("Sales Mgmt", "Regional Mgmt") .withMinApprovalsForGroups(1, 1) .withSingleUserMultiApprovalAllowed(true)- Parameters:
multiApprovalAllowed- When true, the user can approve the same step as many times as the group setting allows- Returns:
- The approval step itself.
- See Also:
-
withParallelStepApprovalAllowed
public WorkflowDTO.ApprovalStepDTO withParallelStepApprovalAllowed(boolean parallelStepApprovalAllowed) Lets a user who is a member of several approving user groups approve for all of them with one action.In the workflow dialog, the user approves for all their groups when no group is selected; the Approve button in the email does the same. Only works together with
withSingleUserMultiApprovalAllowed(boolean).Example:
workflow.addApprovalStep("Approval Step1") .withUserGroupApprovers("Sales Mgmt", "Regional Mgmt") .withMinApprovalsForGroups(1, 1) .withParallelStepApprovalAllowed(true) .withSingleUserMultiApprovalAllowed(true)- Parameters:
parallelStepApprovalAllowed- When set to true and the multiApprovalAllowed option is enabled, the approver approves all parallel steps that the group he is a member of allows.- Returns:
- The approval step itself.
- See Also:
-
withMandatoryComments
Makes comment mandatory for certain actions.Example:
workflow.addApprovalStep("ApproverWithDefault") .withUserGroupApprovers("Group1", "Group2", "Group3") .withMandatoryComments("DENY", "APPROVE") .withMinApprovalsForGroups(1, 1, 2)- Parameters:
actions- for which comment is mandatory. This method accepts only values "APPROVE" and "DENY". Other values will be ignored.- Returns:
- The approval step itself.
- See Also:
-
getApprovers()instead.