Our latest release included a feature that many customer have asked for, custom user fields. This feature allows you to create new fields and assign them to your buyer companies, groups and users. If you allow your user’s to edit the fields they will be displayed in their self admin profile. These field values are available to you as tokens throughout the site. You can reference them in themes, site customization, spec forms and even auto emails. With the explanation of the feature the question then becomes, “What do I do with them?” I want to cover a few ways that they can be used to your benefit.
I want to go beyond the simple “You can use it as a default value” in a spec form. I think that’s understood because you’ve always been able to use those default value tokens before. I’d like to take a different path. I will diagram how you can use custom user fields and tokens to display contact information for their assigned customer service representative on your Home Page.
I’ll first create a new user field named “Rep” and make it a selection type. I’ll set it to display to the user and add some choices for the dropdown and save. Then I’ll assign it to the entire company.
Now, I’ll put the contact information on the home page through the Buyer Site Customization Home Page template. The home page customization looks like this:
[[CustomMessage]]
[[Rep]]
[[Catalog]]
[[Messages]]
[[Orders]]
What I’ve done first is create a span element that will hold the Rep token value. Giving the span an ID property allows me to reference it in a script easily. I then added a div element to hold the result of the script. It will be what is displayed on the page. Then I add the script. I created a JSON object that holds a key value pair that matches the Customer Service reps in the custom user field with phone numbers. Just a simple example. At this point I declare a variable, “rep”. That variable value points to the span element I created to hold the token. Referencing the innerHTML property returns the value the token renders on the page. Finally, I take the token value, look up the pair in the JSON data object, and write it out to the “ContactInfo” div element so it will display on the Home page.
This example doesn’t hold any real world value. I just want to demonstrate to you how, with some imagination, you can do so many things with the information available to you in the new Custom User Fields. As always, you can go to my demo site play with the example I documented today.
If you have any questions about this blog post, please join us on the forum.