Targetprocess

The Targetprocess Developer Hub

Welcome to the Targetprocess developer hub. Here you'll find comprehensive guides and documentation to help you start working with Targetprocess as quickly as possible and support you if you get stuck. Let's jump right in!

Docs

When GitLab Commit pushed - Add new record to Sources tab on Entity View

JavaScript for action:

const branch = args.body.ref;
// Branch is smth like `refs/heads/us12355`
const match = branch.match(/^refs\/heads\/us(\d+)/);

if (match && isFinite(match[1])) {
    const entityId = parseInt(match[1]);
    const commands = args.body.commits.map(commit => {
      return {
        command: "targetprocess:CreateResource",
        payload: {
          resourceType: "Revision",
          fields: {
            Project: {Id: 994},
            SourceControlId: commit.id,
            Description: commit.message,
            CommitDate: commit.timestamp,
            Assignables: {
              Items: [{Id: entityId}]
            },
            RevisionFiles: {
              Items: commit.added.map(addedName => ({
                FileName: addedName,
                FileAction: "Add"              
              }))
            }
          }
        }
      };
    });
    return commands;
}

Updated 3 years ago

When GitLab Commit pushed - Add new record to Sources tab on Entity View


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.