Skip to content

Administration - Smart Quote Rules: Functions Reference

Functions are the building blocks of Smart Quote logic. They allow you to define what happens (the then block) when specific conditions (the when block) are met during the configuration process.

Rules Overview (Example of how rules appear in the Smart Quote setup)

Core Concepts

Smart Quote rules use a domain-specific language (DSL) based on C#. - when: Conditions that must be true for the rule to fire. - then: Actions to perform (Add items, modify time, log errors, etc.). - m suffix: Always use m after numbers (e.g., 5m) to indicate a decimal value.


Logging and User Feedback

Use logging functions to provide real-time feedback to the Sales Rep during configuration.

Function Toast (Popup) Sidebar Message Prevents Finish Usage
LogInformation() No No No Tips/Suggestions
LogMessage() No Yes No Workflow guidance
LogWarning() Orange (Warning) No No Potential issues
LogError() Red (Error) No Yes Invalid configurations

Example: Error Handling

when
    var config = Configurator();
    var length = Attribute_DEC(x => x.NameIs("Length") && x.ValueIsGreaterThan(500m));

then
    config.LogError("Length cannot exceed 500mm for this model.");

Modifying the Router (Tasks)

Tasks define the labor and routing steps. You can add tasks or override their properties dynamically.

Adding a Task with Details

when
    var config = Configurator();
    var material = Attribute_TXT(x => x.NameIs("Material") && x.ValueIs("Steel"));

then
    config.TaskAdd("WELDING")
          .Time(45m)
          .Detail("Heavy duty welding required for steel frame")
          .AddResourceByName("WELD_STATION_01");

Task Modification Functions

  • .Time(decimal): Sets the labor time in minutes.
  • .HourlyRate(decimal): Overrides the default shop rate for this specific task.
  • .Cost(decimal) / .Price(decimal): Directly sets the financial values, bypassing calculations.
  • .Phase(string): Assigns the task to a specific production Phase.
  • .Instruction(string): Links a specific work instruction (by ID).

Modifying the BOM (Items)

Add materials or components based on configuration selections.

Standard Items

Standard items are added to the configuration's Bill of Materials.

then
    config.AddItem("FAN_001", 2.0m); // Adds 2 units of Item "FAN_001"

SKU Items (Standalone Catalog Items)

SKU items are added as standalone line items, bypassing the standard BOM structure. They support a fluent API for overriding catalog defaults.

Function Description
.Description(string) Sets the short description.
.LongDescription(string) Sets the full/long description.
.Cost(decimal) Sets the unit cost.
.Price(decimal) Sets the unit price directly.
.Markup(decimal) Sets price based on cost + markup (e.g., 0.20m for 20%).
.Margin(decimal) Sets price based on desired margin (e.g., 0.25m for 25%).

Example: Advanced SKU Configuration

then
    config.AddSku("CHASSIS-01", 1.0m)
          .Description("Custom Painted Chassis")
          .Category("Chassis")
          .Cost(150.00m)
          .Markup(0.25m); // Price will be 187.50

Financial and Global Adjustments

Price and Cost Factors

Apply global adjustments to the entire quote. This is useful for "Rush Order" surcharges or "Bulk Discount" logic.

when
    var config = Configurator(x => x.TotalPrice() > 10000m);

then
    config.TasksPriceFactor(0.9m);  // 10% discount on labor
    config.ItemsPriceFactor(0.95m); // 5% discount on materials

Controlling Availability

Disable the ability to add a configuration to a Quote or Order based on logic.

then
    config.AddToSalesQuoteAllowed(false); // Force direct-to-order only

Metadata and Descriptions

Setting the Line Item Description

Dynamically build the description that appears on the Customer's PDF.

then
    config.DescriptionSet("Custom Widget - Large - Stainless Steel");

Dimensions and Weight

Set physical properties for shipping calculations.

then
    config.LengthSet(10.5m);
    config.WeightAdd(2.0m); // Adds to existing weight

Advanced Logic

Boolean Operations

Use parentheses to control the evaluation of complex attributes.

when
    var config = Configurator();
    var attr = Attribute_TXT(x => x.NameIs("Color") && (x.ValueIs("Red") || x.ValueIs("Blue")));

Negative Logic (Not)

Trigger actions when an attribute is not present or selected.

when
    var config = Configurator();
    not Attribute_TXT(x => x.NameIs("Power_Type"));

then
    config.LogError("Please select a Power Type.");