Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to play a sound in D365

(0) ShareShare
ReportReport
Posted on by

I need to play a sound in certain conditions; i.e when an error or a warning is thrown.

Can I make that in Ax 365 ? 

 
the following code did not work. I belive the reason is that the code was executed on the server side instead of the client side, so I could not hear the sound. 
[ExtensionOf(formStr(WHSPack))]
final class REVClass_WHSPack_Extension
{
    /// <summary>
    /// MEC_EXT-00027_LandedCostChargesAutomation
    /// Peiqing Jia on 01/29/2023
    /// </summary>
    [FormControlEventHandler(formControlStr(WHSPack, ItemId), FormControlEventType::Modified)]
    public static void ChangeRequestedBy_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        InventInventItemSearchResult result = inventItemSearch.search(this.valueStr());
                
        if (!result ||
            !result.parmItemId())
        {
            ret = checkFailed(/@WAX758/);
            
            System.Media.SoundPlayer YourMPlayer;
            YourMPlayer= new System.Media.SoundPlayer();
            YourMPlayer.set_SoundLocation(https://download01.fangcloud.com/download/a23675d5fba24dbf9d20b50efbf8e629/acfb0471b29cc9eb3bd0f2dd81482dc772eb8aaa36696b11eb50ef4070acae6f/Alarm03.wav/);
            YourMPlayer.Play();
        }
    }
}
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,602 Super User 2024 Season 2 on at
    How to play a sound in D365
    Hi Peiqing,
     
    You got a valuable reply from Martin. Can you tell us what is the benefit and business value of playing a sound?
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,340 Most Valuable Professional on at
    How to play a sound in D365
    Moved from D365 general forum to the Finance forum, because it's clearly about F&O and not about D365 in general.
     
    You're right. The code can't work as you want because X++ us executed on server, not in a browser on client's machine.
     
    You'd have to use client-side JavaScript to do such a thing, which in F&O means creating an extensible control. But it doesn't sound to me like what you want to in this case.
     
    If you want to change the way how error and warning notifications work in F&O, you can also log it as an idea for Microsoft.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,602 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,340 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans