But I've read that won't work if favoriteFood is a ContentPicker2, and I should use a Udi. What is the recommended fool-proof way of doing the above via Udi from the IPublishedContent food (without hitting the database to find food's Udi)?
I've read some things about unwrapping the IPublishedContent--but I don't think it provides the full solution for the above.
How to call Member.SetValue of ContentPicker2 field (Id vs Udi vs Guid)
Hello all,
Using Umbraco 7.7.13
I'm having trouble pinning down the recommended way to use the MemberService to save a member's ContentPicker2 field value.
Here's how I used to do it with Ids according to the documentation (myMember is an IMember, and food is an IPublishedContent):
But I've read that won't work if favoriteFood is a ContentPicker2, and I should use a Udi. What is the recommended fool-proof way of doing the above via Udi from the IPublishedContent food (without hitting the database to find food's Udi)?
I've read some things about unwrapping the IPublishedContent--but I don't think it provides the full solution for the above.
Thank you!
I believe this looks very promising, but I've also read that IPublishedContent.GetKey() can be an empty Guid sometimes:
https://blogit.create.pt/marionunes/2017/11/05/working-with-umbraco-7-6-new-pickers/
Does anyone know why/how IPublishedContent.GetKey() can sometimes be empty?
is working on a reply...