Skip to content

Refresh workflow option set enums and use them instead of literals - #352

Open
Bircck wants to merge 2 commits into
masterfrom
remove-unused-componentstate-enum
Open

Bircck wants to merge 2 commits into
masterfrom
remove-unused-componentstate-enum

Conversation

@Bircck

@Bircck Bircck commented Sep 2, 2026

Copy link
Copy Markdown

Three small changes to the internal workflow option sets, all verified against the generated context in MetadataGenerator.Context, which is produced from a live org and checked into this repo.

Refresh the enums

Enum Added
Workflow_Category ModernFlow = 5, DesktopFlow = 6, AIFlow = 7
WorkflowState Suspended = 2
Workflow_StatusCode CompanyDLPViolation = 3

The other four (Workflow_Type, componentstate, Workflow_BusinessProcessType, Opportunity_StatusCode) already match and are untouched.

Use Workflow_Category instead of literals

WorkflowManager compared category against 3 and 0 in three places, with a // Category: 0 = Workflow, 3 = Action comment spelling out the mapping the enum already encodes. WorkflowReader did the same for statecode and category, and can use the generated workflow_statecode/workflow_category from the context project it already references.

Values are unchanged, so this is behaviour-preserving.

WorkflowState and Workflow_StatusCode still have no callers — refreshed for correctness, not because anything reads them. The legacy MetadataGenerator365/DataHelper.cs has the same literals but no context project to draw from; left alone to keep this small.

Silence CS8981

warning CS8981: The type name 'componentstate' only contains lower-cased ascii characters fires once, on Utility.cs:1210, under net8.0 only. The name deliberately mirrors the Dataverse logical name, and the generated context already wraps every such enum in #pragma warning disable CS8981 — this does the same. Cosmetic: there's no TreatWarningsAsErrors anywhere.

Not in scope

Neither generator filters workflows on type or componentstate, and the test fixtures already hold a mix of type=1 and type=2 records. That's a behaviour change, filed separately.

Verification

Build clean with zero CS8981. 664 net10.0, 656 net462, 83 generator tests, 0 failed.

https://claude.ai/code/session_01YWUbYsznntsbtkmxHDcvaa

The CS8981 warning on `internal enum componentstate` is suppressed the same
way the generated context in MetadataGenerator.Context already handles it:
the name deliberately mirrors the Dataverse logical name of the option set.

While confirming the enums against the current Process (Workflow) table
reference, three were behind Dataverse:

  Workflow_Category    + ModernFlow (5), DesktopFlow (6), AIFlow (7)
  WorkflowState        + Suspended (2)
  Workflow_StatusCode  + CompanyDLPViolation (3)

The category/statecode values were also hardcoded as literals in two places
that these enums already describe, including a comment spelling out the
mapping. Both now use the enums - WorkflowManager via the internal
Workflow_Category, WorkflowReader via the generated workflow_category and
workflow_statecode from its own context.
@Bircck
Bircck force-pushed the remove-unused-componentstate-enum branch from 38f62b2 to 3335ba2 Compare September 3, 2026 08:39
@Bircck Bircck changed the title Remove unused internal enums from Utility.cs Refresh workflow option set enums and use them instead of literals Sep 3, 2026
@Bircck

Bircck commented Sep 3, 2026

Copy link
Copy Markdown
Author

Follow-up on the type/componentstate gap mentioned above is filed as #353 — no action needed in this PR.

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.

1 participant