-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing Flexible Assets #143
Comments
This is intended. Not sure if it stated in more the one place but look at Flexible Assets | Update:
Wild guess here, I don't work with IT Glue anymore so I cannot test this but do you have a Try replacing the dot annotation for adding new keys to your hashtables with squre brackets. $data.attributes.traits += @{
"$($AssetTraits[$i].Name)" = $asset.data.attributes.traits."$($AssetTraits[$i].Name)"
} becomes $data["attributes"]["traits"] += @{
"$($AssetTraits[$i].Name)" = $asset["data"]["attributes"]["traits"]"$($AssetTraits[$i].Name)"
} Since it works with contacts and not flexible assets, there has to be a difference between the two API calls or there is a bug (very possible given the 500 error code), in which case you will have to talk to the IT Glue support. I suggest looking close at what kind of data you have and that everything looks correct. If it does, contact their support. |
I was thinking it had to do with that. It ends up creating that "subobject" (for lack of a better term) as a pscustomobject, even in it's own pulled data, but the $data variable has to go back as a full hashtable, so if the brackets do that, that should do it. I'll update after I've had time to test. Thanks! Edit: I think there was a bit of a misunderstanding. The "contacts" is a subobject inside the flexible-asset, and it does NOT work if it is included. It DOES work without it being included. So, the bit you square bracketed is the working bit, the chunk underneath (nonstringobjects - badly named, I know) is the bit I will have to test. Thanks again though! |
Ok, I've updated the relevant block to as shown below:
I am still getting the same error when attempting to update with a contact (which is basically a full sub-object/array inside the original array). Sorry for the delay, haven't had much time to get back on this one. |
At this point, I would contact the IT Glue support, the problem could very well be at their side. I've had problems before with the API which they helped me solve. |
So, 2 things:
Basically, it reads everything in to the $data variable, and if it's an object type that Powershell doesn't know, it adds it in. I can compare my "asset" to my "data" and everything is exactly the same in terms of object type, membership, etc. Any insight would be appreciated.
Using a Flexible-Asset without the "contact" field, it works without issue:
The text was updated successfully, but these errors were encountered: