web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
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();
        }
    }
}
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    236,879 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.
  • André Arnaud de Calavon Profile Picture
    299,923 Super User 2025 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?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 683 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 620

#3
Martin Dráb Profile Picture

Martin Dráb 563 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans