Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Button Command Error & Not displaying properly.

(0) ShareShare
ReportReport
Posted on by

End result I am attempting to have a selected record update a date field, preferably with a confirmation pop up, but for it to update and then I have Power Automate do the rest. But I cannot get the button to function properly, or at all.

I am attempting to add a custom button on my command bar on a sub-grid.

If(
    Confirm(
        "Send Report to Member POC and all Additional Contacts?",
        {
            Title: "Send Report",
            Subtitle: "Send Report to Member POC and all Additional Contacts?",
            ConfirmButton: "Yes",
            CancelButton: "No"
        }
    );,
    //confirmed
    Patch(Documents,Self.Selected.Item,{'Report Sent':Now()});
    Notify("Report is Scheduled to be sent to Email as Draft for approval.", NotificationType.Success);,
    //canceled
    Notify("Report send Canceled", NotificationType.Error);
)

I was experiencing issues where the button does NOT show up when selecting a record but shows up when no record is selected.
The prompts would show up but nothing would run as I didn't have any record selected for it to run against.

So I updated the button code to:

Patch(Documents,Self.Selected.Item,{'Report Sent':Now()});

I got the button to show up if I put in its visible property that the name field wasn't blank but whether I had a record selected or not I would get this same error.

pastedimage1673483632475v1.png

I am open to any suggestions.

  • earlene Profile Picture
    earlene 15 on at
    RE: Button Command Error & Not displaying properly.

    Thanks for the tips, it helped.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Button Command Error & Not displaying properly.

    Hello,

    I don't know if there is a special article that describes your first point - but it can be implemented using Enable Rule of "SelectedCount" type.

    The following article describes on how to pass selected records to the function - ribbonworkbench.uservoice.com/.../129783-pass-the-currently-selected-grid-row-s-to-a-custo

    And the easiest way to update the record is to use Xrm.WebApi.updateRecord - there are plenty of articles that cover this topic.

    If you experience any issues - feel free to post your progress here so I can help you.

  • Bahalzamon Profile Picture
    Bahalzamon on at
    RE: Button Command Error & Not displaying properly.

    a33ik Do you have a resource I can take a look at that covers how to get the button to only show when an item is selected within a sub-grid and to get it to perform an update on that record so my flow can trigger?

  • a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Button Command Error & Not displaying properly.

    It's up to you. Just my 5 cents. Because I know JS better and Ribbon Workbench tool is superstable over  the years I will always use it over PowerFX.

  • Bahalzamon Profile Picture
    Bahalzamon on at
    RE: Button Command Error & Not displaying properly.

    Bipin Kumar I don't think it is unless I misunderstand your message. I am on a Contact record with a sub-grid that has my custom Document entity listed within it.

    Are you saying I need to add the Contact table into the component library?

  • Bahalzamon Profile Picture
    Bahalzamon on at
    RE: Button Command Error & Not displaying properly.

    a33ik I have no issue using JS. I haven't attempted to use JS on a sub-grid item before.

    Even if that was not the issue, the fact that the button is hidden and shows at the wrong time is still a big issue.

    Adding the PowerFx onto the main form work flawlessly, but I would really like to add it to the sub-grid.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Button Command Error & Not displaying properly.

    Hi,

    Documents is related entity of entity where you added your button?

    If related entity is not already added in the command component library then you will need to open it in canvas studio and add the data source

    learn.microsoft.com/.../commanding-use-powerfx

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Button Command Error & Not displaying properly.

    Hello,

    I know it might be old school but have you considered pure JavaScript instead PowerFX?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans