I have an existing event trigger I am trying to add additional criteria to and am looking for some ideas on the json path. Basically right now, the criteria is:
$.changes[?(@.attribute == "accountingUnit" || @.attribute == "legalEntity")]
and I am trying to add in filter criteria to only send event if positionCode is also included in the event, but either accountingUnit OR legalEntity changes with
$.changes[?(@.attribute == "positionCode" && (@.attribute == "accountingUnit" || @.attribute == "legalEntity"))]
Here is a sample event i have been testing with:
{
"identity": {
"id": "2c9180838222dcdc0182265f16427ce5",
"name": "21097371",
"type": "IDENTITY"
},
"changes": [
{
"attribute": "positionDescription",
"oldValue": "FABRICATION SHIFT C OPERATOR",
"newValue": "LAMINATING SHIFT D OPERATOR"
},
{
"attribute": "positionShortDescription",
"oldValue": "303017",
"newValue": "375573"
},
{
"attribute": "legalEntity",
"oldValue": "530-G2423",
"newValue": "530-G5426"
},
{
"attribute": "accountingUnitDescription",
"oldValue": "G.Goole (265) - LAMINATING SHIFT C",
"newValue": "G.Goole (265) - LAMINATING SHIFT D"
},
{
"attribute": "positionCode",
"oldValue": "303017",
"newValue": "375573"
}
],
"_metadata": {
"triggerType": "fireAndForget",
"triggerId": "idn:identity-attributes-changed",
"invocationId": "4c50578a-aa63-422f-9220-9bbbfa3541ae"
}
}
For comparison, i have done something similar on a different event and it seems to work OK.
filter is
$.requestedItems[?(@.operation != "Remove" && (@.id == "e10bf8643dd8471396880d7e7e51a489" || @.id == "cea271971fe44e5abf09ea38ae876fe7"))]
and the event is
{
"accessRequestId": "19176f8595224785872896ac7d25ead0",
"requestedFor": {
"id": "2c9180878222dc6701822b2845b11ef8",
"name": "Chandru, Swathi",
"type": "IDENTITY"
},
"requestedItems": [
{
"id": "e10bf8643dd8471396880d7e7e51a489",
"name": "GHR Security Administrator - Firefighter",
"description": "HRIT App Sec use only - This role grants firefighter access to perform Application Security functions in GHR.",
"type": "ACCESS_PROFILE",
"operation": "Add",
"comment": "Need access to handle error BODs created as part of monthly user purge activity in IFS"
}
],
"requestedBy": {
"type": "IDENTITY",
"id": "2c9180878222dc6701822b2845b11ef8",
"name": "21039278"
},
"_metadata": {
"callbackURL": "https://koch.api.identitynow.com/beta/trigger-invocations/85f92719-50a9-4631-aede-9d5c9e740b86/complete",
"secret": "eba943f7-bda5-4682-9d1d-adcd32c9a902",
"triggerType": "requestResponse",
"triggerId": "idn:access-request-pre-approval",
"invocationId": "85f92719-50a9-4631-aede-9d5c9e740b86"
}
}
Appreciate any ideas anyone has
Thank you,
Caleb