baoussounda
(Ousmane N'DIAYE)
February 29, 2024, 3:47pm
1
with the following input :
{
"accountId": "test.admin",
"accountOperation": "Create",
"attributeRequests": [
{
"attributeName": "groups",
"attributeValue": "[111, 110]",
"operation": "Add"
}
],
"provisioningResult": "Manual Task Created",
"provisioningTarget": "Manual",
"source": {
"id": "test5d68cb437eb86481c77e63751btest",
"name": "Profil _Metest",
"type": "SOURCE"
},
"ticketId": null
}
i want to retrieve attributeValue when attributeName == groups
Iām able to do that with filter :
$.attributeRequests[?(@.attributeName=='groups')].attributeValue
But i have the folling output :
I want to retrieve it in following format : [111, 110]
Is anyone have a solution for do that ?
amishra97
(Abhinav Mishra)
February 29, 2024, 7:45pm
2
Hi @baoussounda ,
Youāre using the correct JOSN path expression, which will return the desired value.
$.attributeRequests[?(@.attributeName == 'groups')].attributeValue
baoussounda
(Ousmane N'DIAYE)
February 29, 2024, 7:50pm
3
@amishra97 but i have following value :
And i want this format : [111, 110]
JSONpath cannot unpack that array since it is technically a string. If your attribute value looked like this (i.e. without the double quotes)
"attributeValue": [111, 110]
Then you could write this JSONpath expression
$.attributeRequests[?(@.attributeName=='groups')].attributeValue[*]
Which would produce the result you are looking for.
baoussounda
(Ousmane N'DIAYE)
February 29, 2024, 8:49pm
5
Hi @colin_mckibben ,
This expression : $.attributeRequests[?(@.attributeName==āgroupsā)].attributeValue[*]
return an empty array as you can see here :
I think itās due attributeValue that was string.
Yes thatās correct. That jsonpath express would only work if the attribute value was an array instead of a string. Ultimately, you canāt unpack that string the way you want with jsonpath.
1 Like
I will see if i can found another solution.
I have a worfklow that use āProvisioning completedā trigger for specific delimited file and create automatically account in that source after manual action completion.
In my http request action i do post on /v3/accounts :
{
"attributes": {
"groups": "{{$.loop.loopInput.attributeRequests[?(@.attributeName=='groups')].attributeValue}}",
"id": "{{$.loop.context.attributes.uid}}",
"sourceId": "{{$.loop.loopInput.source.id}}"
}
}
iām able to create account on that source , but a multivalued entitlement attribute groups is populated like this :
But i can see that entitlement is correctly assigned, that means a āgroupsā is correctly populated ?
With postman, i have the following value in groups
But with this two cases, entitlements are assigned correctly.
This populated my delemited file source entitlement with bad data :
baoussounda
(Ousmane N'DIAYE)
March 14, 2024, 12:05pm
10
Bonjour,
I resolve this problem by combine two workflows.
In my second workflow use define varaible for replace [ by empty and in my http call for create or update account i add [ and ].
With ā[122,142]ā ==> define variable output is : 122,142
and i call api with : [ 122,142]
Best regards
system
(system)
Closed
May 13, 2024, 12:05pm
11
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.