Toggle menu

User Profile - Save

This field type can be used to automatically save a loaded site user's profile. It will perform this, server-side, when the form is submitted.

The profile should first be loaded into a server-side form helper variable using the Load User Profile field type. This Save User Profile field can then be used to modify the data stored in the form helper variable (see the Data Function property) and then save it back to the database.

If the profile is for a new user (the userID value within the loaded profile data is empty), a new site user will be automatically created before the profile is saved. The new user's name will need to have been stored in the profile data field specified via the User Name Field property. The password will be set to a random GUID.

Properties

LabelDescriptionType Name
Data FunctionThe JavaScript function that is executed server-side to get the user profile data that is to be saved.

An example, assuming the profile data has been loaded into a form helper variable by the Load User Profile field type:

function( helper, processor, props, context ) {
    var profileData = helper.getVariable("USERPROFILE");
    if ( profileData ) {
        profileData.FIRSTNAME = helper.getFieldValue("FIRSTNAME");
    }
    return profileData ;
}

Note that only the FIRSTNAME element within the user profile is being modified here.

The Output Action property of the Load User Profile field will need setting to true to make the form helper variable available for use by this Data Function.

If saving a new user's profile, this Data Function will also need to set the User Name Field's value to the new user's name. For example,

profileData.USERNAME = helper.getFieldValue("USERNAME");
DATAFUNC
User Name FunctionThe JavaScript function that is executed server-side to get a new user's name (when creating a new user). If you are updating an existing user's profile this property serves no purpose.

An example, assuming the new user's name is input via a field on the form:

function( helper, processor, props, context ) {
    return helper.getFieldValue("USERNAME");
}
USERNAMEFUNC
Failure messageMessage to be displayed if the save fails to completeFAILUREMESSAGE
Success messageMessage to be displayed when the save completes successfullySUCCESSMESSAGE
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION
Last modified on November 11, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon