You can now use Field2Base.claimWorkflow() method in the JavaScript Engine that will claim a pending Form in Workflow.
Field2Base.claimWorkflow(refNum, "showClaimResult");
The first argument refNum is required: This is the unique number where you can find from the portal in Online Docs -> Sent Forms
The second argument is a string that indicate a JavaScript function to react to the API result code, [objName].resultCode
When perform this API sucessfully, you will become the owner of the claimed Form and the Mobile Form App will immediately launch the form Draft for you.
Below is the list of [objName].resultCode (integer, 0-10) that represents the possible success and error states for the attempted claim.
- 0: Success – Claim was successful.
- 1: WorkflowNotInPauseForReview – Claim failed due to the requested Form not currently being in the Pending Tablet Edit state.
- 2: PreFillFailedToReassign – Claim failed due to a server side issue with re-assigning the Form.
- 3: PreFillNotFound – Claim failed due to the requested Form never being in a Pending Tablet Edit state.
- 4: WorkflowNotFound – Claim failed due to the requested Form never being in a Workflow.
- 5: OriginalOwnerNotFound – Claim failed due to not being able to find the originally assigned User in our system.
- 6: NewOwnerNotFound – Claim failed due to not being able to find the User in our system that is attempting to claim the Form.
- 7: NotAuthorized – Claim failed due to the User attempting to claim in the Form does not have the Workflow User Role.
- 8: WorkflowDefinitionDoesNotAllowClaim – Claim failed due to the Workflow step not having isClaimable setting enabled in its Workflow definition.
- 9: TargetUserNotFound – Claim failed due to an unknown User error.
- 10: UnknownError – Claim failed due to an unknown server-side error.
Sample Code: (items in bold are required)
Field2Base.claimWorkflow("1111111", "showClaimResult");
function showClaimResult(objResults)
{
var strText;
switch(objResults.resultCode)
{
case 0:
strText = "Success";
break;
case 1:
strText = "WorkflowNotInPauseForReview";
break;
case 2:
strText = "PreFillFailedToReassign";
break;
case 3:
strText = "PreFillNotFound";
break;
case 4:
strText = "WorkflowNotFound";
break;
case 5:
strText = "OriginalOwnerNotFound";
break;
case 6:
strText = "NewOwnerNotFound";
break;
case 7:
strText = "NotAuthorized";
break;
case 8:
strText = "WorkflowDefinitionDoesNotAllowClaim";
break;
case 9:
strText = "TargetUserNotFound";
break;
case 10:
strText = "UnknownError";
break;
default:
strText = "Result Code Not Returned";
break;
}
}
Comments
0 comments
Please sign in to leave a comment.