After you enable Gamification in Dynamics 365, you will notice a new category of workflow steps available to you.
These workflows may be useful to you in controlling how Gamification works (such as automatically triggering KPI rollups, disabling KPI’s, etc), and some of them may be useful for other purposes (stop all running workflows). The following is a brief description of the workflows and plugins provided with the Gamification solution:
Microsoft.Dynamics365.Gamification.AggregationMasterWF:
Retrieves Sales Metrics where game.startdate <= DateTime.Now and game.enddate >= DateTime.Now. Retrieves Data markers and create process and job records of type retrieve.
Microsoft.Dynamics365.Gamification.AggregationWorkerWF:
– Retrieve new Aggregation Values using FetchXML (Group by Sales Metric Id, Player Id, filter by specific date and sales metric ids of updated individual metric records)
– Update Player Data Records using aggregated values in transaction
– If it is not last page -> create Calculation job for next page
– Mark current job for deletion
Microsoft.Dynamics365.Gamification.AuthPlugin
Authenticates the cloud end point and schedules the SendUserWf and PredefinedKPIInitializationWf to run.
Microsoft.Dynamics365.Gamification.CleanWorkerWF
– If it is Player Data Records Job
Retrieve Player Data Records related to appropriate sales metric
Mark records for deletion
If it is not last page -> create Reset job for next page
If it is the last page -> create Reset job for Interim Records
Mark current job for deletion
– Else (it is Interim Records Job)
Retrieve Interim Records related to appropriate sales metric
Mark records for deletion
If it is not last page -> create Reset job for next page
Mark current job for deletion
Microsoft.Dynamics365.Gamification.Configuration.BulkDeleteJobsSetupWf
Deletes data metrics, jobs, processes, player data, interim records.
Microsoft.Dynamics365.Gamification.Configuration.DuplicateDetectionRulesSetupWf
Detects duplicates in Games, Player or Metric data.
Microsoft.Dynamics365.Gamification.CreateProcess
– Create new Data Process
– Create Data Job
– Run Job
Microsoft.Dynamics365.Gamification.CrmVersionTrackerWF
Retrieves the CRM server version.
Microsoft.Dynamics365.Gamification.CurrentVersionWF
Retrieves the organization name.
Microsoft.Dynamics365.Gamification.DailyMarkerTrackerWF
Get midnight marker. Trigger on create of settings
=> Wait for next settings.NextDataMarkerTrackerWFRun
=> Create empty data marker
=> Retrieve changes for data marker using last saved data marker
=> Backup new midnight marker
=> update next run value (+1 day)
=> trigger itself
Microsoft.Dynamics365.Gamification.DailySyncWF
Get games, players and metrics from Azure. Trigger on first authorize on the Login/Register page. Runs daily midnight
=> Wait until settings.NextFSTDailySyncDate
=> Retrieves data from cloud and update CRM records if needed
=> Update NextFSTDailySyncDate+1 day
=> triggers a child workflow (itself)
Microsoft.Dynamics365.Gamification.DataReceiveWorkerWF
Retrieves changes related to an entity based on the data marker.
Microsoft.Dynamics365.Gamification.DropFlagsInterimRecordsWF
– If it is Player Data Records Job
Retrieve Updated Player Data Records
Drop IsUpdated flag
If it is not last page -> create Drop Flags job for next page
If it is the last page -> create Drop Flags job for Interim Records
Mark current job for deletion
– Else (it is Interim Records Job)
Retrieve Updated Interim Records
Drop IsUpdated flag
If it is not last page -> create Drop Flags job for next page
Mark current job for deletion
Microsoft.Dynamics365.Gamification.GameCreateUpdatePlugin
On change in Game start date end date drops the existing data markers and stops any metric handling running processes or jobs and resets all metrics.
Microsoft.Dynamics365.Gamification.Games.GameDatesOffsetChangePlugin
Updates game start and end date.
Microsoft.Dynamics365.Gamification.GetNotCompletedJobWf
Gets Gamifications jobs that are in running state.
Microsoft.Dynamics365.Gamification.GetResetProcessWF
Resets all Gamification jobs.
Microsoft.Dynamics365.Gamification.GetSettingsWF
Retrieves Gamification settings.
Microsoft.Dynamics365.Gamification.HeartBeatWf
Checks if a process is running or not.
Microsoft.Dynamics365.Gamification.KpiStateResetActivity
Resets entity markers related to all metrics.
Microsoft.Dynamics365.Gamification.MarkersCommitWF
– Commit markers
– Drop FullPostFlag if exist
– Drop Sales Metrics Reset Flag
– Set settings.IsCalculationRunning to false
Microsoft.Dynamics365.Gamification.MasterWF
On Demand. Launch calculation iteration
=> Retrieve set sales metrics where related game.startdate <= DateTime.Now and game.enddate >= DateTime.Now
=> Retrieve current data markers
=> If exist
– Create process record (Type – Retrieve)
– For each entity type of retrieved sales metric, create a Job record related to process record with appropriate marker
=> Set state of N created job (N – settings.ThrottleNumber) to Run => start Gamification Worker
Microsoft.Dynamics365.Gamification.Metrics.GameMetricFeedChangePlugin
Resets game metric feeds.
Microsoft.Dynamics365.Gamification.Metrics.InitPredefinedMetricFeedsWorkflow
Creates out of box KPI’s
Microsoft.Dynamics365.Gamification.Metrics.KpiDisablingActivity
Disables entity related KPI’s.
Microsoft.Dynamics365.Gamification.Metrics.MetricFeedDeletePlugin
Deletes KPI data on the cloud side based on the metric feed ID.
Microsoft.Dynamics365.Gamification.Metrics.MetricFeedPreDeletePlugin
Checks if there are any active games running corresponding to the KPI data that is currently being deleted. If they are this will throw an exception.
Microsoft.Dynamics365.Gamification.Metrics.MetricFeedSyncPlugin
Send KPI information to cloud side.
Microsoft.Dynamics365.Gamification.Metrics.MetricFeedSyncWf
Fetches KPI information from the cloud side and syncs it on the CRM side.
Microsoft.Dynamics365.Gamification.Metrics.MetricFeedUpdatePlugin
Activates/Deactivates KPI’s on CRM side.
Microsoft.Dynamics365.Gamification.NewUpgradeUserPlugin
Send new users created to cloud.
Microsoft.Dynamics365.Gamification.NextWorkerWF
Schedules the next job in the process which is in ready state to run.
Microsoft.Dynamics365.Gamification.ObserverWF
=> Runs every 6 hrs
=> Checks state of processes
=> Log the failure and restart processes as needed
Microsoft.Dynamics365.Gamification.PlayersMatchingPlugin
Map players to users.
Microsoft.Dynamics365.Gamification.RestoreMidnightMarkersBackupPlugin
Retrieves midnight markers from cloud side.
Microsoft.Dynamics365.Gamification.RetrievePlugin
Retrieves metrics from cloud.
Microsoft.Dynamics365.Gamification.ScheduledWorkerWF
=> Create a Scheduled process
=> Start it running
Microsoft.Dynamics365.Gamification.SendingCTDisableFlagWF
Send change tracking disabled notification to Gamification cloud end point.
Microsoft.Dynamics365.Gamification.SendingWorkerWF
– Retrieve updated player data records
– Post data to Azure
– If it is not last page -> create Data Sending job for next page
– Mark current job for deletion
Microsoft.Dynamics365.Gamification.SendMetricResetWF
Resets the metric data on the cloud side.
Microsoft.Dynamics365.Gamification.SendUsersWF
=> Get all active users in CRM which have valid first name, last name, email address
=> Send the users to cloud
Microsoft.Dynamics365.Gamification.SettingsCreatePlugin
Creates and update GamificationSettings entity.
Microsoft.Dynamics365.Gamification.StarterWF
Starts on activation, controls when the calculation should run
=> Wait until settings.NextStarterWFRun
=> Retrieve games where related game.startdate <= DateTime.Now and game.enddate >= DateTime.Now
=> If games exist
– Run child workflow (FST Scheduler WF)
– Update settings. NextStarterWFRun (game.enddate + 1day if no overlap, or max(game.enddate) + 1 day if overlaps
=> Else
– Update settings. NextStarterWFRun (+1 day)
=> Run child workflow (itself)
Microsoft.Dynamics365.Gamification.StopAsyncProcesses
Stops all gamification processes.
Microsoft.Dynamics365.Gamification.StopRunningJobsWF
Stops all running processes and jobs.
Microsoft.Dynamics365.Gamification.Telemetry.SendTelemetryWf
This sends out telemetry information periodically.
Microsoft.Dynamics365.Gamification.Throttling.ThrottleTimeoutActivity
Sets time out for gamification operations.
Microsoft.Dynamics365.Gamification.ThrowExWF
Logs exception trace and throws plugin exception.
Microsoft.Dynamics365.Gamification.Update.CustomUpdateStep
Sends App version information to Cloud end point
Microsoft.Dynamics365.Gamification.UserActivityTrackingActivity
– Retrieve entity changes using marker (appropriate page)
– If CT retrieve failed
Send request to Azure (CT failed)
Set settings.CTDisabled to true
Mark current job for deletion
Exit from WF
– Retrieve sales metrics based on specific entity type
– Retrieve players based on sales metrics
– Apply sales metrics filters to retrieved records (Get FetchXML from sales metric, add “IN (retrieved records ids)” condition to id)
– Update Individual Metric Records (for retrieved records) using ExecuteTransaction
– If it is the last page
Update entity marker
– Else
Create new job with the same entity name and marker, but with next page
– Mark current job for deletion