I am attempting to use Object mapping in Config hub to replace the AD servers attribute.
The path is $.connectorAttributes.domainSettings[0].servers[*] and returns a single value for Sandbox. I need to replace it with multiple servers. Tried a few different values but the array is not created properly. I end up getting
“servers”: “server1,server2,server3” rather than
“servers”: [ “server1”,“server2”,“server3”]
Attempts have been:
“server1,server2,server3”
“server1”,“server2”,“server3”
[“server1”,“server2”,“server3”] and a few others I have forgotten. Anyone get this to work?
Hello Ryan, I think the issue may be with the [*] in the path.
$.connectorAttributes.domainSettings[0].servers[*] points to the values inside the array, not the array field itself. I would try mapping the parent path first:
$.connectorAttributes.domainSettings[0].servers
and set the new value as:
["server1","server2","server3"]
If that still saves as "server1,server2,server3" or as a flat string, then Object Mapping may not be the right place to change this value into an array. From what I see, Config Hub Object Mapping is mainly doing value replacement based on JSON Path, and the API examples also show targetValue being handled as a string.
In that case, I would probably update the draft JSON directly after creating the draft, or upload the corrected config JSON with the servers array already set.
I would try dropping the [*] first though. If that does not preserve the array format, the draft JSON route may be the cleaner option.
We found out that if we update it directly and leave it out of the mappings, it leaves the target value, so that seems to be the best option for now. Thanks for the replies!