Run in this form in thedatabase
ALTER table WMAP MODIFY ( MAP_PAINTER %type_char_4000% )
ALTER table WMAP MODIFY ( MAP_USERDATA %type_char_4000% )
ALTER table WMAPTASK MODIFY (MAPTASK_FORM %type_char_4000% )
ALTER table WMAPTASK MODIFY (MAPTASK_DESCRIPTION %type_char_4000% )
ALTER table WMAPTASK MODIFY (MAPTASK_PAINTER %type_char_4000% )
ALTER table WMAPTASK MODIFY (MAPTASK_CONDITION %type_char_4000% )
Ed Davis said: Would anyone have an example for the syntax for updating the form data and attachments.I see the ask in App Developer from Mahesh but no response. "1) How can we initiate workflow with form data. you mentioned to use the action as formUpdate but how do we set the form fields."" 2) How can we get the workflow attachment folder id so we can upload docs while we initiate workflow." With these methods, I think you would have a good baseline Rest pattern for WorkflowsEd
A few months ago I traced initiating a workflow with the REST API and below are the steps I found. Some of the operations here made their way into the @kweli/cs-rest npm package, which you can read about on my blog.
Here's a rough outline of initiating a workflow with the REST API, which is greatly simplified.
POST: /api/v2/draftprocesses parameters: {workflow_id: map_id} - map_id is the dataid of the workflow map
From the response,
let draftprocess_id = results.draftprocess_id
Then,
GET /api/v1/forms/draftprocesses/update params: {draftprocess_id:draftprocess_id}
The response is workflowInfo, which gives you the options for setting up the workflow. E.g.,
workflowInfo
workflowInfo.data.instructions
workflowInfo.data.title
workflowInfo.data.authentication
workflowInfo.data.attachments_on
workflowInfo.data.process_id
Workflow attributes are in workflowInfo.forms, which contains an array with the forms defined on the "Smart View" tab of the Start step. I don't know if the "Initiate in Smart View" settings needs to be enabled for this to show up. The workflowInfo.forms[index].data objects contains the form values that can be modified and submitted to update the workflow:
workflowInfo.forms
workflowInfo.forms[index].data
PUT /api/v2/draftprocesses/${draftprocess_id} params: { action:"formUpdate", values: formValues }
Attachments are a bit tricky since you need to extract the DataID of the attachments folder.
let data_packages = workflowInfo.data.data_packages let attachment_pkg = data_packages.find(pkg => pkg.type == 1 && pkg.sub_type == 1) let attachment_folder_id = attachment_pkg.data.attachment_folder_id
Then use the standard document upload API to upload attachments.
Finally, to initiate the workflow:
PUT /api/v2/draftprocesses/${draftprocess_id} params: { action: "Initiate", comment: comment, authentication_info: { password: password } }
The comment and authentication_info keys are only required if workflowInfo.data.comments_on and workflowInfo.data.authentication keys are true.
comment
authentication_info
workflowInfo.data.comments_on
That's roughly how I did it. I hope it helps.
GET /api/v1/forms/draftprocesses/update params: {draftprocess_id:draftprocess_id} The response is workflowInfo, which gives you the options for setting up the workflow. E.g., workflowInfo.data.instructions - instructions workflowInfo.data.title - title workflowInfo.data.authentication - true/false, whether authentication is required (i.e., a password must be supplied with the call to initiate the WF) workflowInfo.data.attachments_on - true/false, whether attachments are permitted workflowInfo.data.process_id - process id (you'll need this later) Workflow attributes are in workflowInfo.forms, which contains various keys that define the attributes (data type, name, etc). The workflowInfo.forms.data object contains the form values that can be modified and submitted to update the workflow:
Workflow attributes are in workflowInfo.forms, which contains various keys that define the attributes (data type, name, etc). The workflowInfo.forms.data object contains the form values that can be modified and submitted to update the workflow:
workflowInfo.forms.data
action:"formUpdate", values: {{"WorkflowForm_2":"Ed"},{"WorkflowForm_3":"Davis"}} or values: {"WorkflowForm_2":"Ed","WorkflowForm_3":"Davis"} or Other!
"forms": [ { "Columns": null, "data": { "WorkflowForm_2": null, "WorkflowForm_3": null }, "options": { "fields": { "WorkflowForm_2": { "hidden": false, "hideInitValidationError": true, "label": "First_Name", "readonly": false, "type": "text" }, "WorkflowForm_3": { "hidden": false, "hideInitValidationError": true, "label": "Last_Name", "readonly": false, "type": "text" } }
How do you get the form package? as you mentioned workflowInfo.forms returns the information about workflow attributes but I cant find information about the attached forms.
I'm guessing here... modify the Start Step of your workflow and enable "Initiate with Smart View". Then see if on the Smart View tab of the Start Step you can add the form fields(?). Hopefully these will show up in workflowInfo.forms.
workflowInfo.forms.
Chris Meyer said: How do you get the form package? as you mentioned workflowInfo.forms returns the information about workflow attributes but I cant find information about the attached forms. I'm guessing here... modify the Start Step of your workflow and enable "Initiate with Smart View". Then see if on the Smart View tab of the Start Step you can add the form fields(?). Hopefully these will show up in workflowInfo.forms.
Ed Davis said: values: {"WorkflowForm_2":"Ed","WorkflowForm_3":"Davis"}
values: {"WorkflowForm_2":"Ed","WorkflowForm_3":"Davis"}
values: { WorkflowForm_2:[value0_row0,value0_row1], WorkflowForm_3:[value1_row0,value1_row1] }
function authenticate() { var url = "https://myotds.mycompany.local:8443/otdsws/rest/authentication/credentials"; var password = atob(''); var parameters = { 'userName' : 'Admin', 'password' : password }; $.ajax({ contentType: 'application/json', type: 'POST', url: url, data: JSON.stringify(parameters), success: function (resp) { $("div").data("admin", resp.ticket); getDraft(); }, error: function (xhr) { alert(xhr.responseText); } }); }
Ed Davis said: Thanks everyone, it's all working great and I don't think the lack of access to the forms will be a hinder to my app as I can set the attributes like a form.A
Clarkebar2 said: The Smart UI also has another WF Status Widget, this Widget uses an undocumented REST call:/llisapi.dll/api/v2/workflows/status?wfretention=30&kind=InitiatedThis will show you that status of all WFs initiated in the last 30 days. The Widget has a few more parameters but I couldn't figure out how to use them. As far as I know, this is the only way in via the REST API to get the WF status.
This is some very useful information that is often either difficult to find or not available at all. I can see that all posts for this thread are in connection to initiating a workflow as it should be since the thread title is about this matter.
I have a similar requirement - i.e. to update workflow attribute, but for a workflow that has already been initiated. I will be able to get the process id of the running workflow instance and wondering if this can be used as a query param to a REST call if its available for this purpose. /draftprocesses endpoint used in the forum is for an uninitiated workflow. I see some great examples on /workflows endpoint put together by Vishal (and not been able to find anywhere else by way of documentation) - maybe there is one available here to update an attribute?
Any guidance would be great.
Thanks all