Creation of Document Sets

Hi,

We are currently working on a system using PowerAutomate to pull together ProjectWise, P6 and Offline PM data to automate some of our delivery workflow.

Is there a way in the current PowerAutomate connectors to generate a Document Set rather than a Document? We've successfully managed to create a document in the environment via Automate, but cannot find a way to make a set instead.

Any help apprecitated.

  • Hi, there is no connector action for creating a set but you could leverage "Execute WSG request" action for it.

    An example how it could look like:

    Where the body is based on this:

    Create FlatSet
    FlatSet must be created with at least one document. Below is an example of creating FlatSet with two documents. 
    Example: POST {Datasource}/PW_WSG/FlatSet
    {
      "instance": {
        "schemaName": "PW_WSG",
        "className": "FlatSet",
        "changeState": "new",
        "properties": {
          "name": "NewFlatSetName",
          "ParentGuid": {parentProjectId}
        },
        "relationshipInstances": [
          {
            "schemaName": "PW_WSG",
            "className": "SetDocument",
            "direction": "forward",
            "properties": {},
            "relatedInstance": {
              "instanceId": {documentId},
              "schemaName": "PW_WSG",
              "className": "Document",
              "properties": {
              }
            }
          },
        {
            "schemaName": "PW_WSG",
            "className": "SetDocument",
            "direction": "forward",
            "properties": {},
            "relatedInstance": {
              "instanceId": {documentId},
              "schemaName": "PW_WSG",
              "className": "Document",
              "properties": {
            }
          }
        }
        ]
      }
    }

    Hope this helps you!

  • Hi,

    Is there a variation of this which would allow for an update to an existing set, rather than creating a new one? 

    Thanks 

  • Hi,

    If you want to add or remove documents from a Flat Set this Execute WSG Action with these examples might help you:

    Example: POST {Datasource}/PW_WSG/FlatSet/{flatsetId}
    Add document to FlatSet:
    {
      "instance": {
          "instanceId": "{flatsetId}",
          "schemaName": "PW_WSG",
          "className": "FlatSet",
          "properties": {},
          "relationshipInstances": [
            {
              "instanceId": "",
              "schemaName": "PW_WSG",
              "className": "SetDocument",
              "direction": "forward",
              "properties": {},
              "relatedInstance": {
                "instanceId": {documentId},
                "schemaName": "PW_WSG",
                "className": "Document",
                "properties": {}
              }
            }
          ]
      }
    }
    Remove document from FlatSet:
    {
      "instance": {
          "instanceId": {flatsetId},
          "schemaName": "PW_WSG",
          "className": "FlatSet",
          "properties": {},
          "relationshipInstances": [
            {
              "instanceId": {setMemberId},
              "schemaName": "PW_WSG",
              "className": "SetDocument",
              "changeState": "Deleted",
              "direction": "forward",
              "properties": {},
              "relatedInstance": {
                "instanceId": {documentId},
                "schemaName": "PW_WSG",
                "className": "Document",
                "properties": {}
              }
            }
          ]
      }
    }
    - Delete FlatSet
    Example: DELETE {Datasource}/PW_WSG/FlatSet/{flatsetId}

  • Brilliant thank you! This worked for me to add to a Set: