Class: Task

Task

A Backbone model class for Workspace tasks. It allows to perform server actions on a task.

new Task()

Methods

abandon()

Deletes a task created or saved from a startpoint. It triggers the abandoned event.

claim(lockTask)

Claim a task available in a shared queue. It triggers the claimed event.
Parameters:
Name Type Description
lockTask Boolean true when the task is locked, false otherwise.

complete()

Completes a task and the task is passed to the next step as per the process design. It triggers the submitComplete event if the call is successful; returns submitFailed otherwise.

consult(task, userOid)

Consults a task with another user. It triggers the consulted event.
Parameters:
Name Type Description
task Object Task object to be consulted
userOid String Oid of the user with whom task will be consulted

deleteAttachment(attachmentId)

Deletes an attachment or a note. It triggers the attachmentDeleted event.
Parameters:
Name Type Description
attachmentId Number Attachment ID

forward(task, userOid)

Forwards a task to another user. It triggers the forwarded event.
Parameters:
Name Type Description
task Object Task object to be forwarded
userOid String Oid of the user to whom task will be forwarded

generateAvailableCommands()

Generates a list of all the actions that can be taken on a task and associate them with the task.

getAllAssignments()

Gets a list of all assignments for a task. For example, if a user forwards or consults a task with another user, it is an assignment for a task. It triggers the assignmentsFetched event.

getAllAttachments()

Get list of attachments of task. It triggers attachmentsFetched event.

getAttach(attachmentId)

Gets the url of a specific attachment of a task where the attachment is available. It triggers the attachmentURLFetched event.
Parameters:
Name Type Description
attachmentId Number Attachment ID

getTaskHistory()

Populates the task history list for the process instance.

isOwner() → {Boolean}

Checks whether the logged in user is owner of the task or not.
Returns:
true if the logged in user is the owner of the task, false otherwise.
Type
Boolean

lock()

Locks a task and the task cannot be claimed by another user, if shared. It triggers the locked event.

prepareForSubmit()

It is called before submitting a form via DocumentSubmitServlet. It sets the task ID in a session variable (along with expiry time), which is retrieved during the actual submit. It triggers the prepareForSubmitComplete event.

reject()

Returns a task to the previous owner of task. It triggers the rejected event.

save(dataStr)

Saves a task on the server. It triggers the saved event.
Parameters:
Name Type Description
dataStr String XML data string containing form data

select()

Call this function when a task is selected from the tasklist. It fetches all the data needed to render a task.

setVisibility(isVisible)

Sets the visibility of a task. If the visibility is set to false, the task will not be visible to the user afterwards. It triggers the visibilityUpdated event.
Parameters:
Name Type Description
isVisible Boolean When false, the task will not be visible in future, true otherwise.

share(task, userOid)

Shares a task with another user. It triggers the shared event.
Parameters:
Name Type Description
task Object Task object to be shared
userOid String Oid of user with whom the task will be shared

submit(key)

Submits a task after the form data has been pre-submitted.
On failure, if re-render is needed, it renders the task again.
On success, based on the task assignment, the task is either completed or returned back to the previous user.
Parameters:
Name Type Description
key String Submit key returned from the server after submitting form data

submitWithData(dataString)

Submit the form data (passed as string) associated with a task using TaskManager's submit API. It is used for Flex forms, which do not call TaskManager's submit API. It triggers the submitComplete event.
Parameters:
Name Type Description
dataString String XML data string containing form data

unlock()

Unlocks a task. It triggers the unlocked event.

updateAttachment(attachId)

Updates a specific attachment as well the attachment list of task. It triggers the newAttachment event.
Parameters:
Name Type Description
attachId Number Attachment ID

uploadNote(data)

Adds a note to the task. It triggers the noteAdded event.
Parameters:
Name Type Description
data String Note to be added