{
  "Id": "a4ac3c24-b13d-4685-84c1-d2386d7625d1",
  "DisplayName": "Update-Metadata-Field-On-Revoke",
  "Description": "Update the Notes metadata field on revoke with revocation code and comment",
  "Key": "507",
  "KeyDisplayName": "Enterprise Web Server",
  "IsPublished": true,
  "WorkflowType": "Revocation",
  "Steps": [
    {
      "Id": "e0b9b892-b1eb-42c2-8109-126615e99e6f",
      "DisplayName": "Build Notes String",
      "UniqueName": "PowerShell1",
      "ExtensionName": "PowerShell",
      "Enabled": true,
      "ConfigurationParameters": {
        "ScriptParameters": {
          "Comment": "$(cmnt)",
          "Notes": "$(metadata:Notes)",
          "Date": "$(subdate)",
          "RevCode": "$(code)",
          "RevokeBy": "$(revoker)"
        },
        "ScriptContent": "# Declare your parameters at the beginning ($Comment, $Notes, $RevCode, $Date, and $RevokeBy)\r\nparam(\r\n   [string]$Comment,\r\n   [string]$Notes,\r\n   [string]$RevCode,\r\n   [datetime]$Date,\r\n   [string]$RevokeBy\r\n)\r\n\r\n# Append your additional text to the existing text in the metadata Notes field along with the revoker (removing\r\n# the leading 'DOMAIN\\' part for AD users), submission date, revocation code, and comment entered at revocation, \r\n# and beginning the entry with a newline.\r\n$Notes += \"`nRevoked on \" + $Date.ToString(\"MMMM d, yyyy\") + \" by \" + $RevokeBy.SubString($RevokeBy.IndexOf('\\')+1) + \" with revocation option '\" + $RevCode + \"' and comment '\" + $Comment + \"'.\"\r\n\r\n# Return the updated metadata Notes value as MyNotes to the workflow as a hashtable\r\n$result = @{ \"MyNotes\" = $Notes }\r\nreturn $result"
      },
      "Signals": [],
      "Conditions": [],
      "Outputs": {
        "continue": "RESTRequest1"
      }
    },
    {
      "Id": "9528584d-a025-4530-898b-5804ab8fce66",
      "DisplayName": "Keyfactor-Revoke",
      "UniqueName": "KeyfactorRevoke",
      "ExtensionName": "RevokeStep",
      "Enabled": true,
      "ConfigurationParameters": {},
      "Signals": [],
      "Conditions": [],
      "Outputs": {
        "continue": "EndNOOP"
      }
    },
    {
      "Id": "c1159b18-f999-47bc-847a-5c6e2d466114",
      "DisplayName": "End-NOOP",
      "UniqueName": "EndNOOP",
      "ExtensionName": "NOOPStep",
      "Enabled": true,
      "ConfigurationParameters": {},
      "Signals": [],
      "Conditions": [],
      "Outputs": {}
    },
    {
      "Id": "41f37fb8-9aaf-4a1a-b462-82f5de135f1e",
      "DisplayName": "Start-NOOP",
      "UniqueName": "StartNOOP",
      "ExtensionName": "NOOPStep",
      "Enabled": true,
      "ConfigurationParameters": {},
      "Signals": [],
      "Conditions": [],
      "Outputs": {
        "continue": "PowerShell1"
      }
    },
    {
      "Id": "5bb81d07-dbd8-4993-9565-c9d4a9fff9bc",
      "DisplayName": "Update Metadata Field",
      "UniqueName": "RESTRequest1",
      "ExtensionName": "RESTRequest",
      "Enabled": true,
      "ConfigurationParameters": {
        "Headers": {
          "x-keyfactor-requested-with": [
            "APIClient"
          ]
        },
        "DataBucketProperty": "",
        "Verb": "PUT",
        "UseBasicAuth": true,
        "BasicUsername": null,
        "BasicPassword": null,
        "URL": "https://keyfactor.keyexample.com/KeyfactorAPI/Certificates/Metadata",
        "ContentType": "application/json",
        "RequestContent": "{\n   \"Id\": \"$(certid)\",\n   \"Metadata\": {\n      \"Notes\": \"$(MyNotes)\"\n   }\n}"
      },
      "Signals": [],
      "Conditions": [],
      "Outputs": {
        "continue": "KeyfactorRevoke"
      }
    }
  ],
  "DraftVersion": 1,
  "PublishedVersion": 1,
  "Enabled": true
}