Open Preview: Workflows Beta API

Is it also a “bug” if the Workflows option was there previously but has since disappeared? We have a test workflow sending an email when an identity is created which we’re still seeing, but no “Workflows” option in the admin menu.

1 Like

@emarks_clango, yes, that is a bug. You’ll need a ticket to get that resolved.

I just keep getting the “Output was not a valid map” error when trying the hello world example. I really want to have a look what we can do with Workflows but I am getting nowhere. Below is my sample, I tried all sorts of modification but no luck. Some guidance would be very appreciated!

{
	"name": "Hello World!",
	"description": "This is a basic example workflow.",
	"definition": {
		"start": "hello",
		"steps": {
			"complete": {
				"type": "success"
			},
			"hello": {
				"actionId": "sp:send-email",
				"attributes": {
					"body": "Welcome to your first workflow.",
					"context.$": "2c91808370cfc71d0170e8b51e1b7493",
					"from": "[email protected]",
					"recipientId": "2c91808370cfc71d0170e8b51e1b7493",
					"replyTo": "[email protected]",
					"subject": "Hello World!"
				},
				"description": "Test email",
				"nextStep": "complete",
				"selectInput": "$.changes",
				"selectResult": "$.changes",
				"type": "action"
			}
		}
	},
	"enabled": false,
	"owner": {
		"type": "IDENTITY",
		"id": "ff80818155fe8c080155fe8d925b0316",
		"name": "slpt.services"
	},
	"trigger": {
		"type": "EVENT",
		"attributes": {
			"id": "idn:identity-attributes-changed"
		}
	}
}

Here is a sample I had success with last week.

{
“name”: “Hello World!”,
“description”: “This is a basic example workflow.”,
“definition”: {
“start”: “hello”,
“steps”: {
“complete”: {
“type”: “success”
},
“hello”: {
“actionId”: “sp:send-email”,
“attributes”: {
“body”: “Welcome to your first workflow.\nName: ${Name}”,
“context”: {
“Name.$”: “$.identity.name”
},
“recipientId.$”: “$.identity.id”,
“subject”: “Hello World!”
},
“nextStep”: “complete”,
“selectInput”: “$”,
“type”: “action”
}
}
},
“enabled”: false,
“owner”: {
“type”: “IDENTITY”,
“id”: “xxxxxxxxxxxfa71b2573cb”,
“name”: “Mxxxx.Axxxxx”
},
“trigger”: {
“type”: “EVENT”,
“attributes”: {
“id”: “idn:identity-attributes-changed”
}
}
}

do you get this error when you do test workflows? or when you test an actual scenario?

I was also getting that same error until I read the top of the Test Workflow dialog box where it provides you with your internal ID and says to replace any references to an ID with YOUR ID when you do the test :slight_smile: I can’t tell you how many times I tried and got this error before I realize what I was doing wrong.

yes(thats where i was going with my original response),
you get the error, invalid map if you are using the sample json, you will need to replace those with actual values :slight_smile:

Good feedback Ill try this, but in fairness, in the documentation it says

  1. At any point you can select Test Workflow to test the functionality of your steps. Sample input is provided based on the trigger your workflow uses. You can edit this input data to use different values or keep the sample data. When you are ready, select Start Test .

So be good in next iteration to make sure consistent message.

it looks like the documentation(&scrrenshot) is older version than the actual beta, on the page- test workflows, it does say

Each workflow requires an input in JSON format based on the trigger it uses. To test your input, edit the sample JSON below and select Start Test .

Your ID:

Replace the “id” entries with your ID to assign the task or role to yourself.

hope this helped you with resolving the error.

No Dice, anything else you can think of?

{
“identity”: {
“id”: “2c918088761a820101761f75aae8471c”,
“name”: “prince.jones_admin”,
“type”: “IDENTITY”
},
“attributes”: {
“firstname”: “John”,
“lastname”: “Doe”,
“email”: “[email protected]”,
“department”: “Sales”,
“displayName”: “John Doe”,
“created”: “2020-04-27T16:48:33.597Z”,
“employeeNumber”: “E009”,
“uid”: “E009”,
“inactive”: “true”,
“phone”: null,
“identificationNumber”: “E009”,
“isManager”: false,
“manager”: {
“id”: “2c918088761a820101761f75aae8471c”,
“name”: “prince.jones_admin”,
“type”: “IDENTITY”
},
“customAttribute1”: “customValue”,
“customAttribute2”: “customValue2”
}
}

here is my example workflow.

"name": "Hello World!",
"description": "This is a basic example workflow.",
"definition": {
	"start": "hello",
	"steps": {
		"complete": {
			"type": "success"
		},
		"hello": {
			"actionId": "sp:send-email",
			"attributes": {
				"body": "Welcome to your first workflow.",
				"recipientId.$": "$.identity.id",
				"subject": "Hello World!"
			},
			"nextStep": "complete",
			"type": "action"
		}
	}
},
"creator": {
	"type": "IDENTITY",
	"id": "2c9180876ae6b95b016b28ebe5cf7411",
	"name": "Anish_Karkare"
},
"trigger": {
	"type": "EVENT",
	"attributes": {
		"id": "idn:identity-attributes-changed"
	}
}

}

and here is my test workflow input

{
“identity”: {
“id”: “YOURID”,
“name”: “YOUR ID”,
“type”: “IDENTITY”

},
“changes”: [
{
“attribute”: “department”,
“oldValue”: “sales”,
“newValue”: “marketing”
},
{
“attribute”: “manager”,
“oldValue”: {
“id”: “ee769173319b41d19ccec6c235423237b”,
“name”: “nice.guy”,
“type”: “IDENTITY”
},
“newValue”: {
“id”: “ee769173319b41d19ccec6c235423236c”,
“name”: “mean.guy”,
“type”: “IDENTITY”
}
},
{
“attribute”: “email”,
“oldValue”: “[email protected]”,
“newValue”: “[email protected]
}
]
}

Much thanks for the help, I tried this and was able to get a success.

1 Like

Yes, thank you so much. I got a working sample now. Again thanks.

I tried to use the “Get Identity” action as I want to eventually send an email when attibutes have changed and want to add more information in the email than only the records that changed.

I have this simple call which also only gives me “output was not a valid map”

{
	"name": "Hello World!",
	"description": "This is a basic example workflow.",
	"definition": {
		"start": "Get Identity",
		"steps": {
			"Get Identity": {
				"actionId": "sp:get-identity",
				"attributes": {
					"id.$": "$.identity.id"
				},
				"nextStep": "complete",
				"type": "action"
			},
			"complete": {
				"type": "success"
			}
		}
	},
	"creator": {
		"type": "IDENTITY",
		"id": "2c91808370cfc71d0170e8b51e1b7493",
		"name": "[email protected]"
	},
	"trigger": {
		"type": "EVENT",
		"attributes": {
			"id": "idn:identity-attributes-changed"
		}
	}
}

and this is the result:

[
  {
    "type": "WorkflowExecutionStarted",
    "timestamp": "2021-11-17T11:22:23.121189437Z",
    "attributes": {
      "input": {
        "changes": [
          {
            "attribute": "department",
            "newValue": "marketing",
            "oldValue": "sales"
          },
          {
            "attribute": "manager",
            "newValue": {
              "id": "ee769173319b41d19ccec6c235423236c",
              "name": "mean.guy",
              "type": "IDENTITY"
            },
            "oldValue": {
              "id": "ee769173319b41d19ccec6c235423237b",
              "name": "nice.guy",
              "type": "IDENTITY"
            }
          },
          {
            "attribute": "email",
            "newValue": "[email protected]",
            "oldValue": "[email protected]"
          }
        ],
        "identity": {
          "id": "2c91808370cfc71d0170e8b51e1b7493",
          "name": "2c91808370cfc71d0170e8b51e1b7493",
          "type": "IDENTITY"
        }
      }
    }
  },
  {
    "type": "WorkflowTaskScheduled",
    "timestamp": "2021-11-17T11:22:23.121229403Z",
    "attributes": {}
  },
  {
    "type": "WorkflowTaskStarted",
    "timestamp": "2021-11-17T11:22:23.176224624Z",
    "attributes": {}
  },
  {
    "type": "WorkflowTaskCompleted",
    "timestamp": "2021-11-17T11:22:23.210993108Z",
    "attributes": {}
  },
  {
    "type": "ActivityTaskScheduled",
    "timestamp": "2021-11-17T11:22:23.211058047Z",
    "attributes": {
      "activity": "sp:internal:http",
      "input": {
        "id": "2c91808370cfc71d0170e8b51e1b7493",
        "method": "GET",
        "path": "api/v1/identities/2c91808370cfc71d0170e8b51e1b7493",
        "service": "mice"
      },
      "task": "sp:get-identity"
    }
  },
  {
    "type": "ActivityTaskStarted",
    "timestamp": "2021-11-17T11:22:32.830250574Z",
    "attributes": {}
  },
  {
    "type": "ActivityTaskFailed",
    "timestamp": "2021-11-17T11:22:33.167573177Z",
    "attributes": {}
  },
  {
    "type": "WorkflowTaskScheduled",
    "timestamp": "2021-11-17T11:22:33.167596095Z",
    "attributes": {}
  },
  {
    "type": "WorkflowTaskStarted",
    "timestamp": "2021-11-17T11:22:33.197614319Z",
    "attributes": {}
  },
  {
    "type": "WorkflowTaskCompleted",
    "timestamp": "2021-11-17T11:22:33.225631528Z",
    "attributes": {}
  },
  {
    "type": "WorkflowExecutionFailed",
    "timestamp": "2021-11-17T11:22:33.225660035Z",
    "attributes": {
      "error": "output was not a valid map"
    }
  }
]

The ID is the ID shown when I run the TEST and should be my ID. I wonder if someone has been able to use the “Get Identity” with success…

Recommend changing the following:

"$.identity.id" to "$.identity.name"

Be aware of the following:
id = internal SP GUID
name = Account ID, show’s up within Account Details page, under Identity List

This should return the complete identity context of the user. As an example action “Get Identities”

{
“type”: “ActivityTaskScheduled”,
“timestamp”: “2021-11-17T17:XX:XX.XXXXXXZ”,
“attributes”: {
“activity”: “sp:internal:http”,
“input”: {
“id”: “110110”,
“method”: “GET”,
“path”: “api/v1/identities/110110”,
“service”: “mice”
},
“task”: “sp:get-identity”
}
}
`
Things to be aware of

  1. “api/v1/identities/110110” via a microservice called MICE is internal to IdentityNow and Workflow. So you can’t call it via your tenantName.api.identitynow.com

When your workflow completes, it’ll return details about the identity:

{
  "identity": {
    "id": "2c918087796b",
    "name": "110110",
    "type": {
      "attributes": {
        "ListOfKeyPairAttributes":"" 
      }
    }
  }
}

Hope that helps.

-Tbui

Thanks Tom,

But I do not get the results you have in any way. I tried the ID and Name but both fail.

First result when using $.identity.name and second result is the $.identity.id but the internal endpoint always seem to give a 401.

I tested this ‘live’ by enabeling the workflow and adjusting a csv source attribuut and upload this modified csv. The workflow gets triggered and the output is retrieved from the API.

[
    {
        "type": "WorkflowExecutionStarted",
        "timestamp": "2021-11-22T09:44:08.139886451Z",
        "attributes": {
            "input": {
                "_meta": {
                    "invocationId": "3e1419d5-e459-46f0-b2d0-d3ddb7fe3d31",
                    "subscriptionId": "b87873ba-f241-4e34-9f17-95d1de00965b",
                    "triggerType": "FIRE_AND_FORGET"
                },
                "changes": [
                    {
                        "attribute": "triggerSnapshots",
                        "newValue": "{Rule=2c9180877d2a897a017d4707f22b688e}",
                        "oldValue": null
                    },
                    {
                        "attribute": "lastname",
                        "newValue": "Yoda-Family",
                        "oldValue": "Yoda"
                    }
                ],
                "identity": {
                    "id": "2c91808873354f5401737088f1544bb1",
                    "name": "yoda",
                    "type": "IDENTITY"
                }
            }
        }
    },
    {
        "type": "WorkflowTaskScheduled",
        "timestamp": "2021-11-22T09:44:08.139926754Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskStarted",
        "timestamp": "2021-11-22T09:44:08.193940055Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskCompleted",
        "timestamp": "2021-11-22T09:44:08.230313543Z",
        "attributes": {}
    },
    {
        "type": "ActivityTaskScheduled",
        "timestamp": "2021-11-22T09:44:08.230367341Z",
        "attributes": {
            "activity": "sp:internal:http",
            "input": {
                "id": "yoda",
                "method": "GET",
                "path": "api/v1/identities/yoda",
                "service": "mice"
            },
            "task": "sp:get-identity"
        }
    },
    {
        "type": "ActivityTaskStarted",
        "timestamp": "2021-11-22T09:44:16.799538623Z",
        "attributes": {}
    },
    {
        "type": "ActivityTaskFailed",
        "timestamp": "2021-11-22T09:44:17.606880098Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskScheduled",
        "timestamp": "2021-11-22T09:44:17.606906931Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskStarted",
        "timestamp": "2021-11-22T09:44:17.811383898Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskCompleted",
        "timestamp": "2021-11-22T09:44:17.867259614Z",
        "attributes": {}
    },
    {
        "type": "WorkflowExecutionFailed",
        "timestamp": "2021-11-22T09:44:17.867296827Z",
        "attributes": {
            "error": "actionStep(Get Identity) Error: task failed: activity error (type: sp:internal:http, scheduledEventID: 5, startedEventID: 6, identity: 1@59e78c70f7ba@): Get \"https://eu-partner19.mice.services.infra.identitynow.com/api/v1/identities/yoda\": request failed with status 401 (type: Error, retryable: true): request failed with status 401"
        }
    }
]
[
    {
        "type": "WorkflowExecutionStarted",
        "timestamp": "2021-11-22T09:48:27.932628196Z",
        "attributes": {
            "input": {
                "_meta": {
                    "invocationId": "c314c741-f9c9-45ef-8651-45aed7927265",
                    "subscriptionId": "b87873ba-f241-4e34-9f17-95d1de00965b",
                    "triggerType": "FIRE_AND_FORGET"
                },
                "changes": [
                    {
                        "attribute": "triggerSnapshots",
                        "newValue": "{Rule=2c9180867d2a897c017d470beb7d6f39}",
                        "oldValue": "{Rule=2c9180877d2a897a017d4707f22b688e}"
                    },
                    {
                        "attribute": "lastname",
                        "newValue": "Yoda-Family2",
                        "oldValue": "Yoda-Family"
                    }
                ],
                "identity": {
                    "id": "2c91808873354f5401737088f1544bb1",
                    "name": "yoda",
                    "type": "IDENTITY"
                }
            }
        }
    },
    {
        "type": "WorkflowTaskScheduled",
        "timestamp": "2021-11-22T09:48:27.932666954Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskStarted",
        "timestamp": "2021-11-22T09:48:27.982151395Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskCompleted",
        "timestamp": "2021-11-22T09:48:28.012722468Z",
        "attributes": {}
    },
    {
        "type": "ActivityTaskScheduled",
        "timestamp": "2021-11-22T09:48:28.012775003Z",
        "attributes": {
            "activity": "sp:internal:http",
            "input": {
                "id": "2c91808873354f5401737088f1544bb1",
                "method": "GET",
                "path": "api/v1/identities/2c91808873354f5401737088f1544bb1",
                "service": "mice"
            },
            "task": "sp:get-identity"
        }
    },
    {
        "type": "ActivityTaskStarted",
        "timestamp": "2021-11-22T09:48:36.306082376Z",
        "attributes": {}
    },
    {
        "type": "ActivityTaskFailed",
        "timestamp": "2021-11-22T09:48:36.687183056Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskScheduled",
        "timestamp": "2021-11-22T09:48:36.687203517Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskStarted",
        "timestamp": "2021-11-22T09:48:36.718311643Z",
        "attributes": {}
    },
    {
        "type": "WorkflowTaskCompleted",
        "timestamp": "2021-11-22T09:48:37.555960349Z",
        "attributes": {}
    },
    {
        "type": "WorkflowExecutionFailed",
        "timestamp": "2021-11-22T09:48:37.556005017Z",
        "attributes": {
            "error": "actionStep(Get Identity) Error: task failed: activity error (type: sp:internal:http, scheduledEventID: 5, startedEventID: 6, identity: 1@59e78c70f7ba@): Get \"https://eu-partner19.mice.services.infra.identitynow.com/api/v1/identities/2c91808873354f5401737088f1544bb1\": request failed with status 401 (type: Error, retryable: true): request failed with status 401"
        }
    }
]

my other reply with the examples got blocked for some reason, I still only get a 401 response on the get Identity whichever I use. So with Name of Id used the search fails

{
        "type": "WorkflowExecutionFailed",
        "timestamp": "2021-11-22T09:44:17.867296827Z",
        "attributes": {
            "error": "actionStep(Get Identity) Error: task failed: activity error (type: sp:internal:http, scheduledEventID: 5, startedEventID: 6, identity: 1@59e78c70f7ba@): Get \"https://eu-partner19.mice.services.infra.identitynow.com/api/v1/identities/yoda\": request failed with status 401 (type: Error, retryable: true): request failed with status 401"
        }
    }

and

{
        "type": "WorkflowExecutionFailed",
        "timestamp": "2021-11-22T09:48:37.556005017Z",
        "attributes": {
            "error": "actionStep(Get Identity) Error: task failed: activity error (type: sp:internal:http, scheduledEventID: 5, startedEventID: 6, identity: 1@59e78c70f7ba@): Get \"https://eu-partner19.mice.services.infra.identitynow.com/api/v1/identities/2c91808873354f5401737088f1544bb1\": request failed with status 401 (type: Error, retryable: true): request failed with status 401"
        }
    }

Looks like there is no way to get a identity using workflows. :frowning:

Hi Edwin,

Seems I have no option to send you a direct message using this platform, or it’s just my old age preventing me from seeing the “mail” button :slight_smile:

Can you send me a DM ? Maybe I am allowed to reply.

Cheers,

Make sure if you copied workflow from someone else, you change the meta details , specially the owner identity. You are getting 401 because identitynow tries to check for the owner identity in database and fails to find that and that’s why api is throwing unauthorized. I see your owner identity is from grabwosky and username has enh so looks like you need to change that.

Hi Chirag,

Thanks for pointing this out. Weird thing is that I “download” the script using the UI, edit it end upload it again using the UI.
The script I download does not have the Owner :slight_smile:

{
	"name": "Hello World!",
	"description": "This is a basic example workflow.",
	"definition": {
		"start": "Get Identity",
		"steps": {
			"Get Identity": {
				"actionId": "sp:get-identity",
				"attributes": {
					"name.$": "$.identity.name"
				},
				"nextStep": "sendmail",
				"type": "action"
			},
			"complete": {
				"type": "success"
			},
			"sendmail": {
				"actionId": "sp:send-email",
				"attributes": {
					"body": "Welcome to your first workflow.",
					"recipientId.$": "$.identity.id",
					"subject": "Hello World!"
				},
				"nextStep": "complete",
				"type": "action"
			}
		}
	},
	"creator": {
		"type": "IDENTITY",
		"id": "2c9180.......e1b7493",
		"name": "kolden....sky.com"
	},
	"trigger": {
		"type": "EVENT",
		"attributes": {
			"id": "idn:identity-attributes-changed"
		}
	}
}

but the call using the API does show an Owner… Strange… seems like a defect no?