Skip to content

Smart Button PCF Control v1.0.1 - Enhanced Expression Support and Method Calls

Choose a tag to compare

@AhashSritharan AhashSritharan released this 15 Apr 08:13
· 3 commits to main since this release
92572a0

Overview

This release significantly enhances the SmartButton PCF Control with powerful expression capabilities, allowing you to use JavaScript object methods directly in your button configurations. Both managed and unmanaged solutions are available.

New Features

  • JavaScript Method Support: Apply methods directly to field values in all configuration areas:

    • Format dates with .toLocaleDateString(), .getDay(), etc.
    • Format numbers with .toFixed(), .toLocaleString()
    • Manipulate strings with .toLowerCase(), .substring(), etc.
    • Chain multiple methods together for complex formatting
  • Enhanced Expression Evaluator:

    • Improved date handling and comparison in visibility expressions
    • Support for complex expressions with related records
    • Auto-conversion of date strings to proper Date objects
    • Full support for method calls on related record field values
  • Better Type Handling:

    • Proper handling of dates, numbers, and strings in expressions
    • Intelligent type conversion when needed for comparisons

Examples of What's Now Possible

// Format dates in labels
Button Label: Created on {createdon}.toLocaleDateString()
// Format currency in tooltips
Button Tooltip: Annual Revenue: ${revenue}.toLocaleString('en-US')
// Manipulate strings in URLs
URL: https://contoso.com/search?q={name}.toLowerCase().replace(" ", "+")
// Conditional visibility based on dates
Visibility Expression: {createdon}.getDay() === 1  // Show only on Mondays
// Complex expressions with related records and methods
Visibility Expression: {parentcustomerid.parentaccountid.createdon}.getFullYear() === 2025

Installation

  • Import either the managed (recommended for production) or unmanaged solution into your Dynamics 365/Power Platform environment
  • Use the Smart Button PCF control on your forms
  • Configure buttons through the "Button Configuration" table

Requirements

  • Power Platform environment
  • Model-driven app forms

Full Changelog

https://github.com/AhashSritharan/PCF-SmartButton/commits/v1.0.1