How stage / staging environment is populated?

I see in the docs many references to the staging environment, I have access to it, and I see that products and most of the configurations are the same as on the live environment. I'm looking for information/docs that describe how a population of staging data happens when it happens, what will happen when I let's say change the product in the stage environment and then in a production environment, does the product on stage be overwritten? Any Hints are helpful, thank you in advance.

Customizing Distributor Backoffice Pay History Page Results Using Extension Hooks

There are four hooks that impact the Pay History page data that returns: Your best bet is to use the Web Extension, connect ngrok, and connect each hook in Developer Tools -> Process Hooks to that endpoint, then modify . Look up "ngrok" in the developer site for more details. # Associates.GetCommissionChecksHook Using this hook, you can add actual checks to the returned list. For instance, if you want to show a reward point distribution that you kept track of, you could insert it into the list of CommissionCheck objects in the response. # Commissions.GetCommissionCheckDetailsHook This will allow you to modify or embellish Check Detail information. This includes updating info on contributors to the check. You'll see the list of Contributors on the page and in the Response object. This can be added to or updated. # Commissions.GetCommissionBonusDetailsHook This allows updates of contributors, additional bonus detail info, etc. # Commissions.GetCommissionBonusDetailsAfterHook This one impacts columns and values for the Commission Bonus Details. This includes Custom1 - Custom5, which are configurable in the Cloudspark (back office) admin. So, you could add specifics to a bonus and customize the layout to include those things, without touching Cloudspark custom code--just configuration. It's more about layout for this one. Here's some code that shows how to mess with this one: ```csharp using DirectScale.Disco.Extension.Hooks; using DirectScale.Disco.Extension.Hooks.Commissions; using DirectScale.Disco.Extension.Services; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WebExtension.Hooks.Commissions { public class GetCommissionBonusDetailsAfterHook : IHook\<AfterCommissionBonusDetailsHookModel, AfterCommissionBonusDetailsHookModel> { private readonly IAssociateService \_associateService; public GetCommissionBonusDetailsAfterHook(IAssociateService associateService) { _associateService = associateService ?? throw new ArgumentNullException(nameof(associateService)); } public async Task<AfterCommissionBonusDetailsHookModel> Invoke(AfterCommissionBonusDetailsHookModel request, Func<AfterCommissionBonusDetailsHookModel, Task<AfterCommissionBonusDetailsHookModel>> func) { foreach (var item in request.Detail) { var allColumns = new Dictionary<string, object>(); foreach (var column in item.Columns) { string valueToAdd; switch (column.Key) { case "Other0": valueToAdd = "Fred Flintstone"; break; case "Other1": valueToAdd = "Willma Flintstone"; break; default: valueToAdd = column.Value?.ToString(); break; } allColumns.Add(column.Key, valueToAdd); } item.Columns = allColumns; } var result = await func(request); return result; } } } ```

What are the possible options for statuses and types?

What are the possible options for Order.status, Package.Status, and Payment.Status, as well as Payment.PayType?

How to Pass Binary Placement Information via API?

# Question How do I pass binary placement information via an API? # Answer For [custom content in **Cloudspark**](, the **NewApplication** object has a property named **Placements**. This property overrides the application placement that the caller can use to change the default placement during the enrollment process. DirectScale internal V1 and V2 APIs use the **NewApplication** object, but you can only call these from **CloudSpark**, not the Public API. The Public API has a version of the **Application** request object called [**CreateCustomer**](; however, it does not expose the **Placements** property. In short, the Client Extension [**Application** object]( contains all of the information required to enroll a new Associate as well as upgrade an Associate from a Retail Customer to a Distributor. This object has the [**Placements** properties]( You will have to [create a custom API endpoint]( that calls the method on the service inside the Extension.

How does the Text Number field get set when you're creating the customer via the public API?

# Question How does the **Text Number** field get set when you're creating the customer via the Public API? ![]( # Answer Using the [POST Create Customer]( endpoint, you can add the following field: ```json "TextPhone": "+1 801 555-1111", ``` Read more about the Public API in [Public API Overview](

Extension > Costly SQL NVARCHAR Assumption when Using Dapper

Any time we filter in SQL on a VARCHAR column, it's best to send the parameter as an ANSI string. That way it can use the index more effectively. Dapper assumes NVARCHAR, and not all fields are NVARCHAR in Disco. That looks like this: ``` var parameters = new { CommissionBeginDate = commissionBeginDate.Date, CommissionEndDate = commissionEndDate.Date, // BonusGroup = bonusGroup, // REPLACE with the line below BonusGroup = new DbString { IsAnsi = true, Length = 100, Value = bonusGroup }; }; var query = @"Select AssociateID,Sum(Amount) Amount From CRM_CommissionHistory Where [Group] = @BonusGroup And ComPeriodID in (Select recordnumber From CRM_CommissionPeriods Where Begindate >= @CommissionBeginDate And EndDate <= @CommissionEndDate And PeriodName='ClientWeekly') Group By AssociateID "; return dbHelper.Query<AssociateTeamRoyaltyBonus>(query, parameters).ToList(); ``` This will aid in the performance of the query. We mention it only because there are a lot expensive queries that go against the CRM_CommissionAssociateValues, CommissionPeriod, and Stats tables, that will benefit greatly from this addition.

Q: Is there a way to see a list of datapoint filter names in the public apis?

![]( To get a list of Data Point Filters, like the ones shown in the preceding example, you can use the [Get Data Point Categories]( call. Request URL: `` This list is also provided here: [Data Point Categories (GADP)](

Commissions > How often does the system recalculate commissions? Is it on a new order? Or on a schedule? Does it recalculate only the open period or any un-locked period?

I got this from a client, and it's a common question. Here's the answer: For commissions, the system recalculates whenever there is a "commissionable event" (sale, sign-up, refund). So, when an associate creates an order, they are put on the "stats queue". Then, any person impacted by that order is recalculated. Usually this takes 2 minutes for the average company (it changes some based on distributor count and comp plan complexity). So, the updates are nearly real-time. The same is true for "projected commissions". If you look at the guts of the system, it's actually running independent stats jobs for current and future period stats. It uses the comp plan to calculate stats. You can see the settings in the "Commission" section of Advanced Settings for a little more info on it.