How to change Theme/Logo depend on Company, Legal Entity - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Breaking

Saturday, December 5, 2020

How to change Theme/Logo depend on Company, Legal Entity

 How to change Theme/Logo depend on Company, Legal Entity

Song Nghia - Technical Consultant



































Something in your business, you want to change color, theme which is specific for legal.

We can change color, them follow this process
  • -        Colours/Theme applied is one of the values from SysUserInfoTheme Base Enum.
  • -        appl.setTheme is the crux – it will handle the application colour theme.
  • -        Subscribe to the onSetDefaultCompany delegate of Application class.
  • -        Update the Theme value to CompanyInfo new field:
  • -        Below code will help implement the functionality









-        


class VTOMLegalEntityEventHandlers
{
    [SubscribesTo(classStr(Application), delegateStr(Application, onSetDefaultCompany))]
    public static void Application_onSetDefaultCompany()
    {
        appl.setTheme(CompanyInfo::find().VTCompanyTheme);
    }

    [FormControlEventHandler(formControlStr(OMLegalEntity, CompanyThemeControl), FormControlEventType::SelectionChanged)]
    public static void CompanyThemeControl_OnSelectionChanged(FormControl sender, FormControlEventArgs e)
    {
        FormListBoxControl listBox = sender;
        FormRun fr = sender.formRun();
        FormDataSource companyInfo_ds = fr.dataSource(formDataSourceStr(OMLegalEntity, CompanyInfo));
       
        companyInfo_ds.write();
        appl.setTheme(listBox.selection());
    }

}


 
 
Thanks and Copied:  http://daxtechies.blogspot.com/2020/04/folks-i-am-going-to-discuss-beautiful.html

No comments:

Post a Comment