Thursday, October 4, 2012

AX2012 jumpRef in Sys Operation Framwork


In AX2012, if you have an SSRS report that has parameters and you want to customize the “go to main table functionality” of a parameter, here’s how to do it:
In the UI builder of the report, override the postRun() method:

/// <summary>
///     This method registers the dialog field methods to capture events.
/// </summary>
public void postRun()
{
    Dialog dialogLocal = this.dialog();
    DialogField dialogField;

    super();

     // This method should be called in order to handle events on dialogs.
    dialogLocal.dialogForm().formRun().controlMethodOverload(false);

    dialogField = this.bindInfo().getDialogField(this.dataContractObject(),
        methodstr(CustTableReportContract, parmCustTable));
   
    // Override the default jumpRef to use custTableJumpRef.
    dialogField.registerOverrideMethod(methodstr(FormStringControl, jumpRef),
        methodstr(CustTableReportUIBuilder, custTableJumpRef), this);
}


Add a method custTableJumpRef() to be used in place of the default jumpRef of the control, this can be added to the UI builder class of the report:

/// <summary>
///    Provides go to main table (View Details) functionality.
/// </summary>
public void custTableJumpRef()
{
    MenuFunction    menuFunction;
    Args            args = new Args();
   
    menuFunction = new MenuFunction(menuitemDisplayStr(CustTable), MenuItemType::Display);   
   
    // Pass the record selected in the lookup here.
    args.lookupRecord(CustTable::find('4000'));
   
    // If you don't want to pass any queries to the jumpRef form.
    menuFunction.copyCallerQuery(CopyCallerQuery::No);
   
    // Call the jumpRef form.
    menuFunction.run(args);
}

This can be used to override any number of default methods of control to provide customized functionality e.g. lookup.

The Sys Operation Framework (formerly known as the Business Operation framework, or BOF) also follows the same pattern; so you can use the above example in that as well.

Thursday, June 28, 2012

AX2012 - How to control the visibility of FactBox on form thru X++


Before discussing the code, let me point out that this is not recommended, since the user should have control over the visibility of FactBoxes so your design should always take this into consideration; Having said that, if you for some reason want to control the visibility, here’s how to do it:

void toggleFormPartVisibility(boolean _isVisible = false)
{
    PartList                partList;
    FormRun                 formPart;
    str                     formName;
    int                     counter;    
   
    partList = new PartList(element);
   
    //formName is the name of the form that the factbox is referring to.
    formName = formStr(SomeFormPart);
   
    for(counter = 1; counter <= partList.partCount(); counter++)
    {
        if(partList.getPartById(counter).name() == formName)
        {
            formPart = partList.getPartById(counter);
            formPart.design().visible(_isVisible);
            break;
        }
    }
}

Other properties can also be accessed this way, e.g. if you want to refresh the FormPart’s data source:
formPart.dataSource().reread();
formPart.dataSource().refresh();

This will cause some performance issues due to extra RPC calls, so you should have a good reason to take this approach.

Experiment with the other properties and share how it goes.

Thursday, June 9, 2011

Google Celebrates Les Paul's 96th Birthday!

Google has come up with an awesome doodle to celebrate the 96th Birthday of guitar genius Les Paul. The co-creator of the Gibson Les Paul guitars. Any guitar enthusiast worth their salt would know Les Paul.

Whats so amazing about this doodle?? You can play it!! Hover the mouse on the strings to make beautiful guitar music.. or something close. I'm still trying to figure out how to play it to make something resemble the Slash's November Rain guitar solo!

Click on the keyboard (highlights to red) to enable you to play from your keyboard.

Update: Here is what Google has to say about its doodle.

Wednesday, June 8, 2011

Google testing IPv6

The internet is running out of IP address and it seems that Google and Microsoft Bing among others are testing IPv6.



You can test your network's connectivity on IPv6 from here.

Monday, April 11, 2011

Stupid Yahoo!


Don't ask me to upgrade, I'm already using IE9!!

Friday, April 1, 2011

04012011


 Google Motion – a new way to email by just using your body movements? 


YouTube in 1911?



Ernest Hemingway, Albert Einstein, Sherlock Holmes, Groucho Marx and other famous dead people showing up on LinkedIn in people you may know?


Yep. You guessed it. It’s April Fools day; and these are just some of the pranks sprung by Google, YouTube, LinkedIn and others on their unsuspecting and maybe not so unsuspecting users.


 








Tuesday, January 25, 2011

Holding CTRL when opening Excel


Just came across this – if you hold CTRL while opening MS Excel, it will ask if you want to open it in Safe Mode.

It would seem that when opened in Safe Mode, Excel does not load its files and add-ins.

Details of Excel in safe mode and other ways to open it in safe mode are available at the following links:

http://excel.tips.net/Pages/T003365_Starting_in_Safe_Mode.html
http://www.pcpowerguide.com/windows/office/starting-microsoft-excel-in-safe-mode/