Question

I have a member type which has a custom property - lets name it books - of data type checkbox - so multiple choice is possible.

Now I'm trying to update this member programatically with new values for books. In the customxml it comes as cdata, I'm passing a value as

umbraco.cms.businesslogic.member.Member member =  umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
member.SetProperty("memberBooks", booksValue);
member.Save();

where 'booksValue' is a string of values seperated with comma - because it's how it appears in the contentXml.

It doesn't work.

The question is - how do I update the member property/ xml with new multiple values?

Was it helpful?

Solution 2

here is what you need to do:

umbraco.cms.businesslogic.member.Member member = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
member.getProperty(“memberBooks”).Value = booksValue;
member.Save();

I hope this should work. I haven't tried it since long-time but this is how I used it.

OTHER TIPS

I have resolved this issue.

Both

member.getProperty(“memberBooks”).Value = booksValue;

and

member.SetProperty("memberBooks", booksValue);

work

I was just passing wrong values.

In the contentXml they display as values but actually I need to update the property with the ids so if the data type is checkbox list and the values are like:

1 - book

2 - booko

3 - booki

then in the contentXml it displays as a list "book,booko,booki" but to update it programatically I had to pass: "1,2,3" to the property.

So it should be:

member.SetProperty("memberBooks", "1,2,3");

instead of:

member.SetProperty("memberBooks", "book,booko,booki");

I hope it helps others with the same problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top