launchTaskCompletion is a portal URL, so it always loads the portal task page. To claim a task without leaving your startable (dashboard) UI, call the task REST API from the coach and then open or refresh only the part you want.
Claim with the Process REST API (classic resource, works on every BPM 8.5 / BAW version):
// client-side script in the coach (BPM UI Toolkit / plain XMLHttpRequest)
function claimTask(taskId, done) {
var xhr = new XMLHttpRequest();
xhr.open("PUT", "/rest/bpm/wle/v1/task/" + taskId + "?action=assign&toMe=true&parts=none", true);
xhr.setRequestHeader("Accept", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) return;
if (xhr.status === 200) done(null, JSON.parse(xhr.responseText));
else done(JSON.parse(xhr.responseText).Data.errorMessage);
};
xhr.send();
}
claimTask("1234", function (err) { if (err) alert(err); else /* the task is now mine */ openTask("1234"); });On BAW 21 and later the same is POST /bpm/user-tasks/{id}/claim (Process REST v2). Both need the BPMCSRFToken header on the CP4BA / newer traditional servers - obtain it once with POST /rest/bpm/wle/v1/system/login (or /bpm/system/login) and send it with every call.
Then show the task without a full reload:
- In a dashboard built as a CSHS: call the task's human service in a UI Toolkit Modal Section or an IFrame-style control with the task page URL /teamworks/process.lsw?zWorkflowState=1&zTaskId=1234 (the coach renders inside the frame, the dashboard stays).
- Use the Process Portal task list's own behaviour: window.open("/ProcessPortal/launchTaskCompletion?taskId=1234", "_blank") opens a new tab; the dashboard is untouched.
- For a completely custom UI, the "Task Completion" flow of the Process Portal REST API (/rest/bpm/wle/v1/task/{id}?action=finish, ?action=setData) lets you complete the task without any portal page at all.
References