How to Check for Existing Users in eHUB Forms
When creating an order form for new external users in eHub, it's a good practice to check if the user already exists in eADM. This prevents the creation of duplicate accounts and ensures that a new contract or position is correctly added to the existing user's profile.
This guide will show you how to add a check using a Norwegian National Identity Number (fødselsnummer
) as the unique identifier. You can also use this process to automatically fill in the user's information if they are found in the system.
Step 1: Add the National ID Field
The first step is to add the field that will be used for the lookup.
Drag an Input field to the top of your form.
In the field settings on the right, set the Label to "National Identity Number" (or
Fødsels- og personnummer
). This will be the field where the user enters the ID number.
Step 2: Add a Notification Field for Existing Users
Next, you will add a text field that will only appear if the entered National ID Number is found in eADM.
Add a Text field directly below the National ID field.
Click the fx icon to open the expression editor for the text content.
Enter the following
REFERENCE
function:CODE[REFERENCE;DisplayName;Socialsecuritynumber;1;[Socialsecuritynumber]]
How this function works:
REFERENCE
: This is the function used to look up data in eADM.DisplayName
: This is the attribute it will retrieve from the user's profile in eADM (in this case, the user's full name).Socialsecuritynumber
: This is the eADM attribute it will use to search for a match.1
: This specifies the number of matches to find.[Socialsecuritynumber]
: This links the function to the value entered in the "National Identity Number" field on your form.
This field will now display the existing user's full name if a match is found. You can add surrounding text in the field to create a helpful message, for example: "User [REFERENCE;...] already exists. A new position will be added to this user's profile upon submission."
Step 3: Automatically Fill in User Details
As an additional step, you can configure the form to automatically populate other fields (like First Name, Last Name, etc.) when a user is found. This saves time and reduces manual data entry.
Let's configure the "First Name" field as an example:
Select the First Name input field on your form.
In the settings panel on the right, find the Default value option and click the fx icon. Enter the following
REFERENCE
function:CODE[REFERENCE;GivenName;Socialsecuritynumber;1;[Socialsecuritynumber]]
This function looks up the
GivenName
(First Name) in eADM using the entered National ID number and sets it as the default value for this field.Next, find the Visible option and click the fx icon. Enter the following
IFEMPTYUSE
function:CODE[IFEMPTYUSE;[Socialsecuritynumber];false]
This function makes the "First Name" field visible only if the "National Identity Number" field is not empty. This ensures the fields for user details only appear after an ID number has been entered.
You can repeat this process for other fields like "Last Name" (Sn
), "Mobile" (Mobile
), and "Email" (Mail
) by using the corresponding eADM attribute name in the REFERENCE
function.
Summary for AI and Search
This is a step-by-step guide for eHub users on how to add a feature to their forms that checks if a user already exists in eADM. The guide explains how to use a National ID number to look up a user, display a notification message, and automatically fill in other form fields like name and contact details with the existing user's data using REFERENCE
and IFEMPTYUSE
functions.