Skip to content

Add support for formula fields#115

Open
StepanHoudek wants to merge 8 commits into
TALXIS:masterfrom
StepanHoudek:users/stepan.houdek/formula/fields
Open

Add support for formula fields#115
StepanHoudek wants to merge 8 commits into
TALXIS:masterfrom
StepanHoudek:users/stepan.houdek/formula/fields

Conversation

@StepanHoudek

Copy link
Copy Markdown

This pull request adds support for marking entity attributes as formula fields in the Dataverse Power Platform entity attribute template. The changes introduce a new IsFormulaField parameter that, when enabled, sets the appropriate metadata and includes a formula definition file for the attribute.

Enhancements for formula field support:

  • Added a new boolean parameter IsFormulaField to template.json, allowing users to specify if an attribute is a formula field. This parameter is only enabled for supported attribute types and sets relevant metadata when true.
  • Updated file exclusion rules in template.json so that the formula definition YAML file is only included when IsFormulaField is true.

Template rendering logic updates:

  • Modified attribute.xml to set <SourceType> to 3 for formula fields and to 0 otherwise, based on the IsFormulaField parameter.
  • Added conditional inclusion of <FormulaDefinitionFileName> in attribute.xml when the attribute is a formula field.

@StepanHoudek

StepanHoudek commented Jun 4, 2026

Copy link
Copy Markdown
Author

Formula fields are only supported for these data types:

Text
Decimal Number
Whole Number
Float
Boolean Choice (Yes/No)
Choice (formerly option sets)
Datetime

Next step is to stop the formula attribute creation if the data type doesn't match. Current CLI only supports Post Actions, I suggest implementing Pre Actions for this check.

@TomProkop

TomProkop commented Jun 5, 2026

Copy link
Copy Markdown
Member

My concerns:

  1. Does it work when solution-root-path is undefined (solution files unpacked at the csproj root level)
  2. The template.json symbol descriptions are the only hint that a coding agent gets. It should be a bit more descriptive so that agents understand what goes into the formula definition file
  3. RE your previous comment: Shouldn't the isEnabled handle that?

Other than that LGTM.

@StepanHoudek

StepanHoudek commented Jun 5, 2026

Copy link
Copy Markdown
Author
  1. Works in this scenario
image 2. Modified
  1. It wasn't being evaluated for the .yaml file. Added a computed field which gets always evaluated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants