How to add to the Form custom profile field?

Vote:
 

In the section there is a new property:


     

Is there any possibility to extend Form element Hidden visitor profiling to set up the CustId value for the current user, that submits form ?

#170695
Oct 26, 2016 17:17
Vote:
 

Hi  Sviatlana,

From what I can see in:

[ModuleDependency(new Type[] {typeof (EPiServer.Web.InitializationModule), typeof (ShellInitialization)})]
[InitializableModule]
public class InitializationModule : IConfigurableModule, IInitializableHttpModule, IInitializableModule

{

....

private static void SetupCommonSettings()
{
InitializationModule._logger.Information("Common settings initialization, for collecting visitor data (via hidden input)");
Settings.Current.ProfileProperties = new string[10]
{
"Address",
"ZipCode",
"Locality",
"Email",
"FirstName",
"LastName",
"Language",
"Country",
"Company",
"Title"
};

....

}

The Settings seems to not read from XML but having said that you may be able to change this. Something like:

EPiServer.Forms.Configuration.Settings.ProfileProperties.Add (....your new profile ...);

 

And I assume this needs to be done in initialization module.

I haven't tried it but seems to should work. Let me know where you end up with.

Aria

#170708
Oct 27, 2016 6:44
Vote:
 

Did you ever get anywhere with this? These properties seem to be hardcoded in Forms. 

I don't see how your solution would work Aria. 

using EPiServer.ServiceLocation;
using System;

namespace EPiServer.Forms.Implementation.VisitorData
{
    /// <summary>
    /// Configuration (predefined values) for builtin Visitor Data sources
    /// </summary>
    [ServiceConfiguration(typeof(BuiltinVisitorDataSourceConfig))]
    public class BuiltinVisitorDataSourceConfig
    {
       
        /// <summary>
        /// Gets or sets the profile properties (collection of property name string) that used to render visitor data
        /// </summary>
        public string[] ProfileProperties
        {
            get
            {
                return new string[] { "Address", "ZipCode", "Locality", "Email", "FirstName", "LastName", "Language", "Country", "Company", "Title" };
            }
        }

        public BuiltinVisitorDataSourceConfig()
        {
        }
    }
}
#187364
Jan 22, 2018 3:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.