Skip to main content

Load Entity

Overview

This tutorial explains how to create an entity key and then load an entity using that entity key.

What You Will Learn

  • How to create an entity key.
  • How to load an entity using the created entity key.
  • How to display loaded entity data in a message state.

Prerequisites

Activity

Open previously generated Pos/SignOn/PreSignOnValidationExtensionImplementation Application Process using the Application Process Editor

Add state data to the State enactor.mfc.UserKey with the type com.enactor.mfc.user.IUserKey and DisplayName with the type java.lang.String.

Add User Name And Key To State Data

Add output data for the State enactor.coreUI.Username with the type java.lang.String.

Add Output To State

Add State Data

Create an Entity Key

Open the Resource Library view and search for the action CreateEntityKeyAction.

Select Create Entity Key Action

Add the CreateEntityKeyAction action to the application process and route the Fail link from the UserShiftValidationAction to it.

Add Create Entity Key Action

Edit the input parameters as follows:

NameValueType
enactor.coreUI.EntityNameuserjava.lang.String
enactor.coreUI.EntityNamespacehttp://www.enactor.com/retailjava.lang.String

Map the output Key to UserKey.

Create Entity Key Action Mappings

Add a new assign action named AssignUserKey, and route the Success outcome from the CreateEntityKeyAction to this action.

Add Assign UserKey

Add the input enactor.mfc.UserKey with the type com.enactor.mfc.user.IUserKey and enactor.signOn.UserId with the type java.lang.String.

Add Input To AssignUserKey

Add the output enactor.mfc.UserKey with the type com.enactor.mfc.user.IUserKey.

Add Output To AssignUserKey

Add the data assignment with:

  • From Expression: userId
  • To Expression: userKey.userId

Add Data Assignments To AssignUserKey

Load the Entity Using the Entity Key

Open the Resource Library view and search for the action LoadEntityAction.

Select Load Entity Action

Add the LoadEntityAction action to the application process and route the Success link from the AssignUserKey to it.

Add Load Entity Action

Map the UserKey to the Key as input and map the output Entity to DisplayName as entity.displayName.

Load Entity Action Mapping

Display Messages from the Loaded Entity

Add the input as DisplayName in PreSignOnValidationFailedMessage State.

Add Display Name To State

Add the Success from the LoadEntityAction to the PreSignOnValidationFailedMessage State.

Complete Diagram

Update the message for the key ShiftRestrictionMessage text as Access Denied: {displayName}..!! You can sign on only between {allowedStartTime} and {allowedEndTime}. Please try again during your shift. in TrainingPOSExtensionMessages.xml.

Update MessageId

Expected output when logging in with user 000102:

Output Message