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, ...
Suggested Answer

Company Logo - Change and Remove using x++

(0) ShareShare
ReportReport
Posted on by 411

Hi all,

In AX D365FO, I am trying to create separate tab in Operating Unit for Logo upload similar to company logo in legal entity. ie change and remove.

I shall have to ensure some piece of code as well to upload and remove logo from the same form, for which I tried extending form control using CoC but no luck.

[ExtensionOf(formControlStr(OMOperatingUnit, Change))]
final class ChangeLogoButton_Extension
{

                             public container imageContainer;
                             public str imageFilePathName;


public void clicked()
{

                 if (ReportCompanyLogo.uploadImageFile())
                {
                   imageContainer = ImageReference::GetPackedBinaryData(imageFilePathName);
                   element.showImage(LogoImage);
                   element.insertImage(LogoImage,CompanyImageType::CompanyLogo);
                 }
                   next clicked();
}

}

Somehow I am not able to achieve it using CoC becasue I am getting an error that ReportCompanyLogo and LogoImage are not declared, 

where as ReportCompanyLogo is tab which is set to AutoDeclaration yes.

Please suggest.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Maybe you can try to call "FormTabPageControl reportCompanyLogoLocal = ReportCompanyLogo" before your if statement. And then refer to this tab page by "reportCompanyLogoLocal" instead of "reportCompanyLogo".

    Does this resolve your error about "ReportCompanyLogo" being not declared?

  • babalalex Profile Picture
    411 on at

    Thanks Nikolaos for prompt reply.

    No It did not resolve my error.

    Do we have any other way so that we can upload the image or change or delete it ?

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Yes, I'm sure.

    Perhaps it's easier if you move most of your code away from the CoC classes, and instead create a new standalone class that you call from a new MenuItemButton. Then, once you've handled the upload in your own class, you can try to show your image on the form.

  • Suggested answer
    mhdshb1 Profile Picture
    1,250 on at

    Hi babalalex,

    Did you try to use Event handlers?

    Based on your code, it can be accomplished by Pre Event Handler

    Then you can refer to ReportCompanyLogo tab

    FormRun form = args.getThis();
    FormDesign design = form.design();
    FormTabPageControl ReportCompanyLogoLocal = design.controlName(formControlStr(OMOperatingUnit, ReportCompanyLogo)) as FormTabPageControl;

  • Suggested answer
    babalalex Profile Picture
    411 on at

    Thanks Mohammad for inputs.

    I have made it possible with creating new class and creating all the logic for upload - Add, Change and remove.

    Through this class i was using the logic of standard classes.

    Now its done.

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
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans