Skip to content

Add general_approval section visibility logic based on statuscode#2

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-general-approval-logic
Draft

Add general_approval section visibility logic based on statuscode#2
Copilot wants to merge 2 commits intomasterfrom
copilot/add-general-approval-logic

Conversation

Copy link

Copilot AI commented Feb 24, 2026

Dataverse forms need the general_approval section shown only when Status Reason (statuscode) is set to Pending (545630001), hidden otherwise.

Changes

  • WebResources/formLogic.js — New JavaScript web resource with FormLogic.onStatusCodeChange(executionContext) that toggles visibility of the general_approval section based on the statuscode value.
FormLogic.onStatusCodeChange = function (executionContext) {
    var formContext = executionContext.getFormContext();
    var statusCodeAttribute = formContext.getAttribute("statuscode");
    if (!statusCodeAttribute) { return; }

    var isPending = statusCodeAttribute.getValue() === FormLogic.StatusCode.Pending; // 545630001

    formContext.ui.tabs.forEach(function (tab) {
        tab.sections.forEach(function (section) {
            if (section.getName() === "general_approval") {
                section.setVisible(isPending);
            }
        });
    });
};

Deployment

Register FormLogic.onStatusCodeChange on:

  • Form OnLoad event
  • statuscode field OnChange event

Both registrations require "Pass execution context as first parameter" enabled.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…logic

Co-authored-by: ljrain <1426613+ljrain@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logic to show general approval section for pending status Add general_approval section visibility logic based on statuscode Feb 24, 2026
Copilot AI requested a review from ljrain February 24, 2026 21:31
@ljrain
Copy link
Owner

ljrain commented Feb 24, 2026

This should be included in the onload event that we already have and make sure the approval option is empty unless a value is in the database

@ljrain ljrain assigned Copilot and unassigned ljrain and Copilot Feb 24, 2026
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