Introduction
In some architectural setups the user account is created automatically in Entra ID (or another Identity Provider). Since Entra ID is in that case the master of the e-mail address field, it should also be updated in Epower. This can be done manually but the examples below describe how this can be done via the API.
There are 3 objects where you could fill in the e-mail address:
- User: the e-mail address on the user is used to communicate with the employee (reminder messages etc)
- UserAuthentication: here the UPN (User Principal Name) - which is in most cases the same as the e-mail address - should be filled in the authorize the user and enable SSO for that user.
- BusinessContact: the e-mail address filled in on this object is used to show in the Who's who in the application
Example per object
User
The GraphQL mutation request below is an example of how you could create/update a user. The referenceNumber used in the variables is the unique identifier used in the Epowerhr application. If there is already a user for that specific referenceNumber, the application will perform an update. In the other situation a new user will be created.
Since we have specified "id" as a column in the request, we will get the "id" of the user record as result.
| Request | GraphQL Variables |
|
mutation saveUserFunction($user: UserInput!) {
saveUser(user: $user) {
id
}
}
|
{
"user": {
"active": true,
"firstName": "Gert",
"lastName": "Van Meerbergen",
"timeZone": "Romance Standard Time",
"email": "gert.van.meerbergen@company.com",
"personReference": { "referenceNumber": "123456" }
}
}
|
User Authentication
Before creating the user authentication, the "user" object (see above) should already exist.
The approach is the same as for "User". The application will use referenceNumber in this example to see if there is already a record and will try to update it. If the UserAuthenticaiton record doesn't exits, it will create it.
By specifying "Office365" as authenticationTypeCode, it will know that it can authenticate the user using Microsoft Entra ID.
The field "login" should contain the UPN which is in most cases the same as the e-mail address.
| Request | GraphQL Variables |
|
mutation saveAuthFunction($userAuthentication: UserAuthenticationInput!) {
saveUserAuthentication(userAuthentication: $userAuthentication) {
id
}
}
|
{
"userAuthentication": {
"authenticationTypeCode": "Office365",
"enabled": true,
"login": "gert.van.meerbergen@company.com",
"personReference": { "referenceNumber": "123456"}
}
}
|
BusinessContact
This request is optional. If you also want to show the e-mail address in the contact details the colleagues can consult in the applicaiton, it is recommended to also use this request to update the e-mail address.
| Request | GraphQL Variables |
|
mutation saveContactFunction($businessContact: BusinessContactInput!) {
saveBusinessContact(businessContact: $businessContact)
}
|
{
"businessContact": {
"businessEmail": "gert.van.meerbergen@company.com",
"referenceNumber": "123456"
}
}
|