Techno-Functional Dynamics 365 F&S Data Model Tutorial, Part 18 of 25- Loyalty Reward Points Process

Techno-Functional Dynamics 365 F&S Data Model Tutorial, Part 18 of 25- Loyalty Reward Points Process

Loyalty reward points

Reward Points Process

It has been a long, exhaustive, and fruitful journey regarding these blog post series! D365 is vast domain to encapsulate more than 25 business processes, that’s for sure, We will continue to describe the functional steps, table structure(s) and code samples for the fairly important business processes. With the mixed techno/functional approach, our goal is to provide developers and the business users a unique viewpoint and a better approach on both facets of the domain. I hope you enjoy this post about Loyalty Reward Points as much as the rest of the series. And please remember, we are always here to help with your Dynamics 365 implementation(s) – so whenever you feel the need, please reach out to us. – Brandon Ahmad

With the advent of Gamification and its evolution into the canvas of a commercial world, now the participation patterns can be monitored, and meaningful responses can be obtained from the desired segments. Reward points are the types of scoring mechanisms that you offer to your customers and these can be either redeemable or non-redeemable. Redeemable reward points can be exchanged for products. On the other hand, non-redeemable reward points are used for tracking purpose or utilized as gate pass to advance a customer to the next tier in a loyalty program.

In addition, reward points are referenced in tier rules and are used to qualify a customer for a specific tier. Also, reward points are referenced in loyalty schemes in earning and redemption rules. In earning rules, you specify the rewards that a customer can earn for a specific activity, although in redemption rules, you specify the reward that the customer can redeem.

How this Reward Points Works?

A good example of a loyalty scheme can be a Frequent Flyer program that Airlines, also use to reward returning customers. Those programs work with rules that determine how a customer earns points and how he or she will redeem them (such as how many miles a customer can accumulate per flight and If those miles will translate to discounts or a free fly ticket).

Certainly, implementing a reward points scheme in your business is important because it stimulates sales. Also, with implementation of the Gamification into business process, the customer is more in-charge of his journey of interaction and thus plays a vital role in stretching the lifecycle, it also impacts and augments customer referrals and the chance of customers returning increases tenfold.

Quick Functional Recap

Let’s start, with required functional steps for creating reward points for customer

STEP 1

Go to Retail (or Retail and Commerce in the latest version) > Customers > Loyalty > Loyalty reward points.

STEP 2

Click New to create the new reward points. You can use this reward points in reward program and reward schemes.

STEP 3

Enter your reward points information, type value in Reward point ID, this is the id through which you can manage the reward points for customers, Type value in the description, select the reward points type which can be amount or quantity depending upon the nature of reward points you are creating.




STEP 4

Enter the general detail for the reward points, select currency, check, or uncheck the redeemable checkbox.  In the Expiration time value field, enter a number, In the Expiration time unit field, select an option

STEP 5

Click Save button to save your updated record

To create a Royalty Scheme, follow these functional steps.

STEP 1

Go to Retail > Customers > Loyalty > Loyalty schemes

STEP 2

Click new to create a new Royalty scheme that is tied to the reward program you created above

STEP 3

Enter the Scheme ID, The Description and select a loyalty program from the drop-down list. Finally, click save.

Loyalty Reward Points: Instructor Brandon D365 Data Model

STEP 4: DEFINE THE RULES

Now that you have created the scheme, it’s time to define the rules that will define the scheme. First, click add line in the “Earning Rules” tab, then select a program tier, activity type, activity amount, activity currency and Reward Point ID from the respective drop-down fields and enter the Reward points. You can optionally specify a Start and End date.

Loyalty Reward Points: Instructor Brandon D365 Data Model Tutorial

STEP 5

In the “Redemption rules” tab, click on Add Line and then add a Reward point ID, enter the reward points and select a Redemption type. You can optionally enter an Amount or quantity, the currency when applied and a Start and End date.

Loyalty Reward Points: Instructor Brandon D365 Data Model Tutorial Part 3

Quick Technical Recap

Here are the details of some important tables which are used in the reward creation process. By reading this valuable information you will get a better understanding of the technical process involved in creating loyalty reward points.

Retail Loyalty Card

  1. Contains the loyalty cards information such as CardNumber, party which is the name of customer and CardTenderType.
  2. All the information of customers and party can retrieve from this table with the enrollment date.
  3. This table helps to get the Tender details of different parties which is useful for reporting purposes.
Field Data Types Description
CardNumber String Primary Key Identifier of the RetailLoyaltyCard Table. Contains information of loyalty card number for loyalty Reward
Party String This field contains the information of party (Customer) name
LoyaltyEnrollmentTime Date This field contains information of Loyalty Enrollment Time. This means, how long before the enrollment expires
CardTenderType Enum This field contains the information about card Tender type. The types are card tender, no tender, as contact or blocked
LoyaltyEnrollmentDate Date Date at which the loyalty is being enrolled

Retail Loyalty Reward Point

  1. Contains the measurement of the loyalty programs.
  2. This table holds the information of redeemable loyalty reward points.
  3. All the reward points details are stored in this table, this table is used for getting all the detail of loyalty reward points available in the company.
Field Data Types Description
RewardPointId String This field is the primary key identifier of the Retail Loyalty Reward Point table
ExpirationTimeUnit Enum Contains the expiration time frame for reward points such as Month or Day
RewardPointCurrency String This fields contains the currency type for reward points
RewardPointType Enum Type of reward point which can be quantity (free or extra items) or amount (A price discount)
Redeemable Boolean Determines if the reward points are redeemable or not

Retail Loyalty Card Reward Point Adjustment

  1. Contains the loyalty adjustment information of the customer for tracking the status of their loyalty points.
  2. Adjusted amount or quantity of the customers can be retrieved from this table.
  3. Adjustment status of customers loyalty reward points is stored in this table which is used in reporting purposes.
Field Data Types Description
AdjustmentId String Primary key identifier of the RetailLoyaltyRewardPointAdjustment table
AdjustmentStatus Enum Contains the information of status of adjusted reward points such as Reverse, Waive etc.
LoyaltyCard String This fields contains the information of the loyalty card.
RewardPoint String This fields contains the information of reward points
TransactionDate Date Contains the date of the reward point’s adjustment

Retail Loyalty Card Reward Point Trans

  1. This table stores all the transaction details of retail loyalty card reward points including adjusted points and card number of the customers.
  2. This table is very useful for reporting purposes to get the information of adjusted points and transactional history of the customers.
  3. Loyalty card number details of customers can be retrieved from this table.
Field Data Types Description
StringContains the Royalty Card Number
CustAccount String This field contains the customer account code.
AdjustmentId String Contains the identifier of the adjustment of the previous table (Foreign Key)
ReceiptId String Receipt id of the customers is stored in this field (Foreign Key)
CardTenderType Enum Tender type of the parties is stored in this field such as Contractor, Blocked etc. More types can be defined depending of the user’s needs

ERD – Entity Relation Diagram

Here is the ERD for the creation of the loyalty reward points, by looking at the ERD you will get a deep understanding of the technical details of this process

Code

The following code creates a new Loyalty Reward point in Dynamics 365. Please keep in mind that if you run this code, you’ll need to be using a model that references the following models: ApplicationSuite, Currency, and Retail.

class RetailLoyaltyReward 
{
    // <summary>
    // Runs the class with the specified arguments.
    // </summary>
    // <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)
    {
        RetailLoyaltyRewardPointEntity retailLoyaltyRewardPointEntity; // This line of code instantiates an object of the RetailLoyaltyRewardEntity class

        /*We run the class's code in a try-catch block
        to check if there is a duplicated RewardPointID
        if this condition is true, the code returns an error*/

        try

        {

            ttsbegin;// Begins a SQL transaction, in this case we are inserting data

            retailLoyaltyRewardPointEntity.RewardPointId = "TestRewardID"; // Reward ID

            retailLoyaltyRewardPointEntity.Redeemable = NoYes::No; // Redeemable option enabled/disabled

            retailLoyaltyRewardPointEntity.RewardPointCurrency = "USD"; // currency

            retailLoyaltyRewardPointEntity.RewardPointType = RetailLoyaltyRewardPointType::Amount; // Reward Point Type

            retailLoyaltyRewardPointEntity.ExpirationTimeUnit = RetailDayMonthYear::Month; // expiration time

            retailLoyaltyRewardPointEntity.ExpirationTimeValue = 4;// Expiration time value

            retailLoyaltyRewardPointEntity.VestingTimeValue = 100; // Vesting time value

            retailLoyaltyRewardPointEntity.VestingTimeUnit = RetailDayMonthYear::Month; // Expiration time unit

            retailLoyaltyRewardPointEntity.MaximumLoyaltyRewardPoints = 500; // Maximum reward points

            retailLoyaltyRewardPointEntity.insert(); // This line inserts all the data in the retailLoyaltyRewardPoint table

            info(strFmt("Your Reward point %1 has been created", retailLoyaltyRewardPointEntity.RewardPointId)); //Successful completion message

            ttscommit; // Applies the changes to the database



        }
        /*As we mentioned above if there is a duplicated ID,
        this code section will be executed instead. This code
        Notifies the user that the ID already exists*/

        catch (Exception::DuplicateKeyException)

        {

            throw Exception::DuplicateKeyException;

        }

    }

}

The following code is used to create a loyalty reward scheme. For that reason you need to include the same models from the previous code:

class RoyaltySchemeCreation
{        
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)
    {   
        RetailLoyaltySchemeEntity  retailLoyaltySchemeEntity; // This line of code instantiates an object of the RetailLoyaltySchemeEntity class
        

        /*We run the class's code in a try-catch block
        to check if there is a duplicated LoyaltySchemeId
        if this condition is true, the code returns an error*/

        try

        {

            ttsbegin;// Begins a SQL transaction, in this case we are inserting data

            retailLoyaltySchemeEntity.LoyaltySchemeId = "SchemeTest"; //Loyalty Scheme ID 

            retailLoyaltySchemeEntity.Description = "Scheme Test"; // A description of the loyalty scheme

		retailLoyaltySchemeEntity.insert(); // This line inserts all the data in the retailLoyaltyScheme table

            Info(strFmt("Your Loyalty Scheme has been created",retailLoyaltySchemeEntity.LoyaltySchemeId)); //Successful completion message

            ttscommit; // Applies the changes to the database
          

        }
        /*As we mentioned above if there is a duplicated ID,
        this code section will be executed instead. This code
        Notifies the user that the ID already exists*/

        catch(Exception::DuplicateKeyException)

        {

            throw Exception::DuplicateKeyException;

        }

    }

}

Summary

In this post, you have:

  • Learned how to create a new Loyalty reward Point and a new Loyalty Scheme
  • Familiarized yourself with a step by step procedure for those processes
  • Explored the technical aspects of The Loyalty Reward Point and the Loyalty Scheme Process
  • Looked at ERD, tables and X++ runnable code of the process
  • Understood the importance of the tables RetailLoyaltyCard, RetailLoyaltyRewardPoint, RetailLoyaltyCardRewardPointAdjustment, RetailLoyaltyCardRewardPointTrans.

In the first place, we sincerely hope that you enjoyed part 18 of our exciting series on the Dynamics 365 data model. We aim to provide quality service at all times.  And as always, if you need to reach me, you know how to get in touch by reaching out to me here.  — Brandon Ahmad, founder of InstructorBrandon and Dynatuners

Leave a Reply

Your email address will not be published. Required fields are marked *