Loyalty Reward Points D365 Data Model Tutorial
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
In other words 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.
Furthermore, reward points are referenced in tier rules and are used to qualify a customer for a specific tier. Above all, 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 Loyalty Reward Points Process 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).
Firstly, implementing a reward points scheme in your business is important because it stimulates sales. Secondly, 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.
Loyalty Reward Points D365 Data Model Tutorial explains types of scoring mechanisms offered to customers either redeemable or non-redeemable.
Quick Functional Recap
To demonstrate let’s start with required functional steps for creating reward points for customer.
STEP 1: Loyalty Reward Points
Go to Retail (or Retail and Commerce in the latest version) > Customers > Loyalty > Loyalty reward points.
STEP 2: Create New Reward Points
Click New to create the new reward points. Likewise, you can use this reward points in reward program and reward schemes.
STEP 3: Enter Your Reward Points Information
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.
Looking for Microsoft Dynamics 365 Training Courses, Instructor Brandon can help you in this as we have the most advanced Dynamics 365 Training Courses from Microsoft along with Top Level Certifications which can add real-time value and enhance your career as a professional in IT World.
Moreover, you can also read about Microsoft courses and Dynamics 365 certifications with every possible detailed information provided.
STEP 4: General Detail of your Reward Points
Furthermore, 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: Save your Reward Point Details
Finally, Click Save button to save your updated record.
Not to mention create a Royalty Scheme, kindly follow these functional steps.
STEP 1: Loyalty Schemes
Go to Retail > Customers > Loyalty > Loyalty schemes
STEP 2: Create New Royalty Scheme
Click new to create a new Royalty scheme that is tied to the reward program you created above.
STEP 3: Enter Scheme Details & Select Loyalty Program
Enter the Scheme ID, The Description and select a loyalty program from the drop-down list. Finally, click save.
STEP 4: Define the Rules of Scheme
Now that you have created the scheme, it’s time to define the rules that will define the scheme. Firstly, click add line in the “Earning Rules” tab, secondly 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.
STEP 5: Add a Reward Point ID
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.
Quick Technical Recap of Reward Creation Process
Likewise, here are the details of some important tables which are used in the reward creation process. In other words by reading this valuable information you will get a better understanding of the technical process involved in creating loyalty reward points.
Retail Loyalty Card
- Contains the loyalty cards information such as Card Number, party which is the name of customer and Card Tender Type.
- All the information of customers and party can retrieve from this table with the enrollment date.
- This table helps to get the Tender details of different parties which is useful for reporting purposes.
Field | Data Types | Description |
Card Number | String | Primary Key Identifier of the Retail Loyalty Card Table. Contains information of loyalty card number for loyalty Reward |
Party | String | This field contains the information of party (Customer) name |
Loyalty Enrollment Time | Date | This field contains information of Loyalty Enrollment Time. This means, how long before the enrollment expires |
Card Tender Type | Enum | This field contains the information about card Tender type. The types are card tender, no tender, as contact or blocked |
Loyalty Enrollment Date | Date | Date at which the loyalty is being enrolled |
Retail Loyalty Reward Point
- Contains the measurement of the loyalty programs.
- This table holds the information of redeemable loyalty reward points.
- 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 |
Reward Point ID | String | This field is the primary key identifier of the Retail Loyalty Reward Point table |
Expiration Time Unit | Enum | Contains the expiration time frame for reward points such as Month or Day |
Reward Point Currency | String | This fields contains the currency type for reward points |
Reward Point Type | 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
- Contains the loyalty adjustment information of the customer for tracking the status of their loyalty points.
- Adjusted amount or quantity of the customers can be retrieved from this table.
- Adjustment status of customers loyalty reward points is stored in this table which is used in reporting purposes.
Field | Data Types | Description |
Adjustment ID | String | Primary key identifier of the Retail Loyalty Reward Point Adjustment table |
Adjustment Status | Enum | Contains the information of status of adjusted reward points such as Reverse, Waive etc. |
Loyalty Card | String | This fields contains the information of the loyalty card. |
Reward Point | String | This fields contains the information of reward points |
Transaction Date | Date | Contains the date of the reward point’s adjustment |
Retail Loyalty Card Reward Point Trans
- This table stores all the transaction details of retail loyalty card reward points including adjusted points and card number of the customers.
- This table is very useful for reporting purposes to get the information of adjusted points and transactional history of the customers.
- Loyalty card number details of customers can be retrieved from this table.
Field | Data Types | Description |
String contains the Royalty Card Number | ||
Customer Account | String | This field contains the customer account code. |
Adjustment ID | String | Contains the identifier of the adjustment of the previous table (Foreign Key) |
Receipt ID | String | Receipt id of the customers is stored in this field (Foreign Key) |
Card Tender Type | 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 for Creation of Loyalty Reward Points
For instance 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 for New Loyalty Reward Point in Dynamics 365
Most importantly, the following code creates a new Loyalty Reward point in Dynamics 365. In addition, please keep in mind that if you run this code, you’ll need to be using a model that references the following models: Application Suite, Currency, and Retail.
[sourcecode language=”c-sharp”] class RetailLoyaltyReward{
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;
}
}
}
[/sourcecode]
Above all, the following code is used to create a loyalty reward scheme. Similarly for that reason you need to include the same models from the previous code:
[sourcecode language=”c-sharp”] 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;
}
}
}
[/sourcecode]
Summary: Loyalty Reward Points Instructor Brandon D365 Data Model Tutorial
In conclusion to this post Loyalty Reward Point Instructor Brandon D365 Data Model Tutorial there is a lot to learn. To summarize, following are the outcomes which can be learned from our blog post:
- 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 Retail Loyalty Card, Retail Loyalty Reward Point, Retail Loyalty Card Reward Point Adjustment, Retail Loyalty Card Reward Point Trans.
In addition, we sincerely hope that you enjoyed part 18 of our exciting series on the Dynamics 365 data model. In short we aim to provide quality service at all times. Moreover, if you need to reach me, you know how to get in touch by reaching out to me here. – Brandon Ahmad, founder of Instructor Brandon and Dynatuners.