Sitecore - WFFM : Link contact facet with user profile field - mongodb

I'm working on a Sitecore 8 Update 2 site.
I'm also using the web forms for marketers.
I've set up a login and register form using WFFM. I was able to link fields on the form with the fields of the user profile ( the one used in User Management )
However when i want to make a "Update Contact Details" i can't link the fields on the form with the profile fields as before. Now i have to select a "contact facet". I added one of these and WFFM picked up on this, so now i can link the field on the form with a facet.
The last link i'm missing is linking this facet ( stored in Analytics - MongoDB ) to the profile field.
Does anyone know how to achieve this ?
Bonus: This started off as a slighty different question, you can read more about this issue here:
How to update sitecore user with webforms for marketers ( Update Contact Details )

First you need to add the Create User Save Action and setup the email address as the username.
Then you need to add the User login Save Action straight after that. This is because the Update Contact Details Save action only applies to logged in users.
Then you can use the Update Contact Details Save Action. This action will create data in MongoDB under the logged in user name - so if you go to the Identifiers collection MongoDB a new entry will be created (See screen shot below).
So in short the aspnet_membership data and the MongoDB data is linked via the username in WFFM. In aspnet_users - UserName and in MongoDB by way of an identifier. You can't mix the MongoDB and aspnet_profile data they belong in two separate places.
So once you have created this user in WFFM you could call up their details using the analytics API using the identifier:
Tracker.Current.Session.Identify(username);
var personalInfo = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal");
Hope that makes sense :)

Related

How to populate fields of an online form

I created a custom record (child of Inventory item) and an online form.
The final goal it's to send a link to a user (not a netsuite user) to display the different informations of this custom record. The user will be able to update some values and submit the form.
I saw it's possible to link a script file to this form, but I need the ID of the record to load it and populate every field of the form.
With normal forms, we have the internalid of the record as an URL param but in this case there is nothing in the URL .
Do you know any way to achieve that ?
A solution for the final goal could be:
Create an empty Suitelet (provides external link for User). Or refer to step 4 for contents.
Stored on the Custom record or via script (created in step 3) you can add to the external link, to include the record type and id as url parameters (&recordtype=customrecord&recid=12345). Be sure to avoid reserved parameter names.
Create a UserEvent, Client, or Scheduled Script to send email to User based on your requirements (in the email include the custom external suitelet link). User will click on the link and land on a NetSuite looking webpage (not requiring credentials).
Modify empty Suitelet. Suitelet should when context.request.method===GET: get parameters, load record(s), get data from record(s), create form, display data to User, display fields for User to enter data, add submit and refresh/cancel button, write/display the form with all fields. Upon submission (when context.request.method is not GET) you can use record.submit method to update the custom record(s).
NetSuite Suite Answer Id 74607 has a Sample Custom Form Suitelet Script from that can be very helpful.

SUGARCRM plugin - webservice client with setup

I have a task to develop plugin for SugarCRM. Plugin should be "hooked" to contacts, leads and/or targets.
After I add contact to SugarCRM plugin should send data (with some fileds) to specific webservice (method to insert new person into DB).
I did create logical hook to contacts and before save I send data to webservice.
My biggest problem are fields. SugarCRM admin should be able to make setup for plugin like this
Plugin gets list of fields from webservice
Admin maps fields from "SugarCRM contacts" to "webservice persons" fields
for example
SugarCRM contact | webservice person
"first_name" => "firstname"
"last_name" => "familyname"
"gender" => "mf"
....
So when contact is added to SugarCRM, plugin should be able to read this setup and match every field before sending to webservice.
Can someone give me tips how to start with this, is there something similar online?
Thanks
You could create a dropdown menu where the left value is the SugarCRM Field name and the right value is the Webservice field name. Then direct users/system administrator to modify this dropdown in the Dropdown Editor, which has a nice and easy interface.
The plugin can then access this menu as a key => value array with $GLOBALS['app_list_strings']['my_list_name']
Alternatively, you can create your own configuration page if you want to develop a custom interface for this. A starting point for that might be this article, although it was written with SugarCRM 6 in mind: http://www.profilingsolutions.com/archive/quick-configuration-pages/
The configuration page would write to the Configurator (stored in config_override.php), as Antonio Musarra pointed out.
Either way, a caveat you'll encounter is that users will mistype field names. You'll need some sort of validation in your webservice call to ensure that all fields actually exist within the web server and within SugarCRM.

How can i get Last login user date time and update in user form in online CRM 2011

Hello i have created on field in user(systemuser) Form.so i need to show Last Login Date time in that field.so i have to write PlugIn/script or anything.so basically my question is i get the information from Audit View.but how can i write Plugin and on which entity.because i cant find the Entity Audit in Plugin Registration tool.if so then may be i can write the plugin on Create Audit and update it on User Form.
I have just tried in one sample like below but i cant find date field.but my question is where can i write plugin and update user form.
var query = from a in orgContext.CreateQuery("audit")
where (int)a["operation"] == 4 &&
a["objectid"] == "E39383B6-AFBB-45DD-9F4A-C140A03F1871"
select a;
how can i get that field from audit.
In short i want last login date and time for Login User..
Is there any way?
CRM 2011 doesn't support tracking when users login / logout. If you're running locally you'd have to hack together some sort of system that read IIS logs and then updates a custom field on the User entity itself...

Drupal 6: altering the profile form

I've added several fields to user profile using the standard profile tool. Now I want to validate data entered by a user; for example, I added a field called "email" and I want to let the users enter only valid emails to this field.
How can I achieve this?
You can select the field type "email" for profile fields that will automatically validate, but if you wish to do it manually, use hook_form_alter to add a validation callback to the form. Here's an article that covers the concept - http://befused.com/drupal/additional-validation-function

vBulletin database

Whats up.
I'm looking for some information about linking a vBulletin user database with my actual website's database. I do already have a users table, users have their main website profiles and all, but I would also like them to be able to use the same account on the forum (forum not up yet)
So is it fairly simple to do that? I'm simply asking because I have no clue, and don't know where to start!
Any help would be really appreciated!
unless you want to do some serious editing to the vbulletin code i suggest using vbulletin's user table for everything. if you did the main site yourself it should be alot easier for you to edit it then to edit vb.
just connect to the database like normal. then use mysql to check their username/password like so:
SELECT * FROM `usertable` WHERE `username` = '$username' AND `password` = MD5(CONCAT(MD5('$password'),salt)) LIMIT 1
if you need to include extra data for your main site be careful just adding rows to the user table as vbulletin doesnt like that. few ways around it
make a vb plugin to the "userdata_start" hook with this code:
$this->validfields['custom_usertable_row'] = array(TYPE_INT, REQ_YES);
change TYPE_INT if your not saving an integer. and REQ_YES if the row can be null.
add custom user profile fields. from the admincp User Profile Fields>Add User Profile Field
it will add the field to a different table called userfield which you can get by joining the tables in a query
SELECT user.username, userfield.field1 FROM user LEFT JOIN userfield ON user.userid=userfield.userid
make your own table and join like above.