Assigning Custom Tag to a Custom profile

Posted by Community Admin on 03-Aug-2018 04:23

Assigning Custom Tag to a Custom profile

All Replies

Posted by Community Admin on 08-Dec-2013 00:00

Can anyone help me out.

I have a custom classification named "Disciplines" which is a flat taxon.
I also have a custom profile type named "contractor" which has been assigned with the custom taxon Disciplines.

In code, how do I assign one of the taxons to the profile field???

I can get the custom profile and assign a value to the ContactNumber field just fine via the below code.
(This is from a initial create user method thus the use of CreateProfile method)

var profName = UserProfilesHelper.GetUserProfileTypeNames().Where(u => u.Contains("contractor")).SingleOrDefault();
 var userProfile = profileManager.CreateProfile(user, profName);
 userProfile.SetValue("ContactNumber", ContactNumberTextField.Value.ToString());

I can get the Taxon via
var taxon = taxManager.GetTaxa<FlatTaxon>().FirstOrDefault(s => s.Title == "Disciplines");

But how do I assign one of the taxon's, for example "Generalist", to the Contractor custom profile?

Any help would be appreciated.
Thanks

This thread is closed