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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Calendar date convert in the arabic language in (D365F&O)

(0) ShareShare
ReportReport
Posted on by 351

Hi all,

I want to hijiri calendar date so that i wrote a code below its not working.

[ExtensionOf(formStr(SysUserSetup))]
final class SysUserSetup_Extension
{

    public void run()
    {
        FormComboBoxControl comoBoxCtrl = this.control(this.controlId(formControlStr(SysUserSetup, UserInfo_PreferredCalendar))) as FormComboBoxControl;
        UserInfo userinfo = this.dataSource().cursor();
        if (isLanguageArabic(userInfo.Language))
        {
            comoBoxCtrl.visible(true);
        }
        else
        {
            comoBoxCtrl.visible(false);
        }
        next run();
    }

}

Control level code:

class SysUserSetup_Form_EventHandler
{
    
    /// 
    ///
    /// 
    /// 
    /// 
    [FormControlEventHandler(formControlStr(SysUserSetup, UserInfo_PreferredCalendar), FormControlEventType::Leaving)]
    public static void UserInfo_PreferredCalendar_OnLeaving(FormControl sender, FormControlEventArgs e)
    {
        FormComboBoxControl comboxCtrl = sender as FormComboBoxControl;
        UserInfo userInfo = sender.dataSourceObject().cursor();
        if(isLanguageArabic(comboxCtrl.text()))
        {
            comboxCtrl.visible(true);
            userInfo.preferredCalendar = PreferredCalendar::Hijri;

        }
        else
        {
            comboxCtrl.visible(true);
            userInfo.preferredCalendar = PreferredCalendar::Gregorian;
        }
    }

}

What am i doing wrong above the code? its possible in D365Fo ?

Please give me a example for that ?

Thanks  

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    Hi

    Please have a look at this old thread:

    community.dynamics.com/.../739157

    community.dynamics.com/.../835415

  • waytod365 Profile Picture
    351 on at

    Thanks for your replay WIll,

    I saw the two threads and its related ax 2012 and another one is SSRS hijiri related.

    Now, what i what to know its possible to visible in the SysUserSetup form in the hijiri date? if so, how can i do that ? give me a example for that?

  • Verified answer
    Martin Dráb Profile Picture
    237,970 Most Valuable Professional on at

    I think I'm finally getting what you're trying to achieve.

    But in my version of F&O, similare code already exists in the form:

    void run()
    {
        super();
        
        docuToolbarButtonActive.allowEdit(sysUserInfo.DocuHandlingActive);
    
        element.updateControlStates();
        userInfo_DS.validateCalendarClientSessions();
    
        // Disable non-Gregorian calendar for RTM
        userInfo.PreferredCalendar = PreferredCalendar::Gregorian;
    
        // Enable Arabc calendar option if Arabic language.
        if (isLanguageArabic(userInfo.Language))
        {
            // Disable non-Gregorian calendar for RTM
            userInfo_PreferredCalendar.visible(false);
        }
        else
        {
            userInfo_PreferredCalendar.visible(false);
        }
        this.loadDefaultPages();
    }

    But there is a bug - visibility is always set to false, never to true. This is something you should report to Microsoft and request a hotfix (if none already exists).

    The problem with your code is that you run it before standard code (next run()) and standard code overwritten anything you set. You need to move you logic after standard code:

    public void run()
    {
        next run();
        
        FormComboBoxControl comoBoxCtrl = this.control(this.controlId(formControlStr(SysUserSetup, UserInfo_PreferredCalendar))) as FormComboBoxControl;
        UserInfo userinfo = this.dataSource().cursor();
        if (isLanguageArabic(userInfo.Language))
        {
            comoBoxCtrl.visible(true);
        }
    }

  • waytod365 Profile Picture
    351 on at

    Thanks for your replay sir, its a bug on which version sir?

    The before run next won't open that form anymore we are receiving error while a open that form.

    I do agree with this (You need to move you logic after standard code).

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar 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... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans