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
LogRequired() Blue (Required) Yes Yes Required first-screen selections (gates Add to Quote)
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 and Requirement 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.");

Gating Required Selections:

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

then
    config.LogRequired("Please select a Color to see pricing and BOM.");

Documents and Attachments

Manage how documents are handled during configuration.

Document Management

The Documents object provides a fluent interface for attaching and merging documents.

Function Description
Documents.Merge(nameOrId) Adds a document to be automatically merged into the final generated PDF (e.g., Quote PDF).
Documents.Link(nameOrId) Adds a document as a clickable link/reference without merging it into the PDF.
Documents.Template(nameOrId) Specifies an additional template that should be generated as a separate file.

Example: Evaluation Agreement

when
    var config = Configurator();
    var isEval = Attribute_TXT(x => x.NameIs("Quote_Type") && x.ValueIs("Evaluation"));

then
    // Generate the standard quote PLUS the evaluation agreement
    config.Documents.Template("Customer Product Evaluation Agreement");

    // Merge product specs into the main PDF
    config.Documents.Merge("Standard_Product_Specs");

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).
  • .RequireDocument(string): Adds a requirement that a specific document (e.g., "Material Test Report") must be attached to this task before it can be completed.

Example: Quality Requirement

then
    config.TaskAdd("FINAL_INSPECTION")
          .RequireDocument("Material Test Report")
          .RequireDocument("Calibration Certificate");

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

Add other configured products to the quote based on the current configuration. These are added as separate line items.

AddRelatedConfiguredItem

Initializes the addition of a separate configured product. Attributes can be passed to the sub-configuration fluently.

Function Description
.WithAttribute(name, value) Sets an attribute for the related item.
.ConfigureAsync() (Optional) Manually triggers the configuration.

Example: Adding a Warranty

then
    config.AddRelatedConfiguredItem("WARRANTY-GOLD")
          .WithAttribute("Duration", "3Y")
          .WithAttribute("Coverage", "Full");

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.");