Table of Contents

Search

  1. Preface
  2. Introduction to Business Entity Services
  3. Enterprise Java Bean Business Entity Service Calls
  4. Representational State Transfer Business Entity Service Calls
  5. Simple Object Access Protocol Business Entity Service Calls
  6. Services for Cross-reference Records and BVT Calculations
  7. Supporting Corporate Linkage Service
  8. External Calls to Cleanse, Analyze, and Transform Data
  9. Using REST APIs to Add Records
  10. Using REST APIs to Upload Files

Attaching Files to Tasks

Attaching Files to Tasks

Create the metadata for a file and then upload the file content to a temporary storage. After you upload the file, attach the file to a triggered task or an existing task.
To attach a file to triggered tasks or existing tasks, in the Provisioning tool, enable attachments for task triggers, task types, and task actions. For more information, see the
Multidomain MDM Provisioning Tool Guide
.
  1. To create the metadata of a file, use the Create File Metadata REST API with TEMP as the storage type.
    For example, the following request creates the metadata for the
    file1.txt
    file:
    POST http://localhost:8080/cmx/file/localhost-orcl-MDM_SAMPLE/TEMP { “fileName”: “file1.txt”, “fileType”: “text”, “fileContentType”: “text/plain” }
    Always create the file metadata in the TEMP storage.
    The Create File Metadata REST API returns an ID for the file. The file ID is in the following format:
    <Storage Type>_<RowID>
    . Where the RowID refers to the row ID of the file that you upload to the storage.
    In the example, the API call returns the following ID for
    file1.txt
    :
    TEMP_SVR1.1VDVS
    You can use the file ID to upload, attach, update, and delete the file.
  2. To upload the file, use the Upload File Content REST API with TEMP as the storage type.
    For example, the following request uploads the file to the TEMP storage:
    PUT http://localhost:8080/cmx/file/localhost-orcl-MDM_SAMPLE/TEMP/TEMP_SVR1.1VDVS/content Test attachment content: file 1
    After you upload a file, the TEMP storage stores the file for a pre-configured period of 60 minutes. You must attach the file to a task before the pre-configured period expires.
  3. Attach the file to the task that is triggered when you manage records.
    • To attach the file to the task that is triggered when you create a record, use the Create Business Entity REST API with the
      taskattachments
      parameter.
      For example, the following request creates a record and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      POST http://localhost:8080/cmx/cs/localhost-orcl-DS_UI1/Person?systemName=Admin&taskAttachments=TEMP_SVR1.1VDVS Content-Type: application/json { firstName: "John", lastName: "Smith", Phone: { item: [ { phoneNumber: "111-11-11" } ] } }
    • To attach the file to the task that is triggered when you update a record, use the Update Business Entity REST API with the
      taskattachments
      parameter.
      For example, the following request updates a record and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      PUT http://localhost:8080/cmx/cs/localhost-orcl-DS_UI1/Person/233?systemName=Admin&taskAttachments=TEMP_SVR1.1VDVS { rowidObject: "233", firstName: "BOB", lastName: "LLOYD", Phone: { item: [ { rowidObject: "164", phoneNumber: "777-77-77", $original: { phoneNumber: "(336)366-4936" } } ] }, $original: { firstName: "DUNN" } }
    • To attach the file to the task that is triggered when you merge a record, use the Merge Business Entity REST API with the
      taskattachments
      parameter.
      For example, the following request merges a record and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      POST http://localhost:8080/cmx/cs/localhost-orcl-DS_UI1/Person/2478245?action=merge&taskAttachments=TEMP_SVR1.1VDVS Content-Type: application/<json/xml> { keys: [ { rowid: "2478246" } ], overrides: { Person: { firstName: "Charlie" } } }
    • To attach the file to the task that is triggered when you unmerge a record, use the Unmerge Business Entity REST API with the
      taskattachments
      parameter.
      For example, the following request unmerges a record and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      POST http://localhost:8080/cmx/cs/localhost-orcl-DS_UI1/Person/2478248?action=unmerge&taskAttachments=TEMP_SVR1.1VDVS { rowid: "4880369" }
  4. Attach the file to an existing task.
    • To attach the file when you update a task, use the Update Task REST API with
      attachments
      in the request body.
      For example, the following request updates a task and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      PUT http://localhost:8080/cmx/cs/localhost-orcl-MDM_SAMPLE/task/urn:b4p2:15934 { taskType: { name: "UpdateWithApprovalWorkflow" }, taskId: "urn:b4p2:15934", owner: "John", title: "Smoke test task - updated", comments: "Smoke testing - updated", "attachments": [ { "id": "TEMP_SVR1.1VDVS" } ], ... }
    • To attach the file when you execute a task action, use the Execute Task Action REST API with
      attachments
      in the request body.
      For example, the following request executes a task action and attaches the file with the file ID
      TEMP_SVR1.1VDVS
      :
      POST http://localhost:8080/cmx/cs/localhost-orcl-MDM_SAMPLE/task/urn:b4p2:15934?taskAction=Cancel { taskType: { name:"UpdateWithApprovalWorkflow", taskAction: [{name: "Cancel"}] }, taskId: "urn:b4p2:15934", owner: "manager", title: "Smoke test task 222", comments: "Smoke testing", "attachments": [ { "id": "TEMP_SVR1.1VDVS" } ], ... }
After you attach a file to a task, the process moves the file from the TEMP storage and stores the file together with the task data in the BPM storage. The ID of the file changes to
taskId::filename
.

0 COMMENTS

We’d like to hear from you!