Showing posts with label hide. Show all posts
Showing posts with label hide. Show all posts

Tuesday, March 8, 2016

Disable/Hide Modules from Ax2012

Today I found an interesting way to disable modules from AX for all users. One of our clients had asked us to do so for them. There are ways which we all are aware of like disabling configuration keys, disable licenses or maybe through code.

I had simply put a different country code (other than the base country) to the modules need to be hidden. When we do this those modules will only be available to that specific country whose code is attached. So this worked perfectly in our case. :)

Saturday, February 6, 2016

Hide parameters in Report dialog Ax2012

There are different ways to do it. Some of them are:



Method 1:

Why the default ranges will come in Dialog?:

Because in the Query used it will show the index fields of the Table, so to hide the Default ranges you have to overload the showQueryValues() in the Controller class: return FALSE.

Credit: http://axdevhelper.blogspot.com/2012/09/how-to-hide-default-query-parameters-in.html


Method 2:

The View group fields comes from InventDimViewContract class which is added as a parm method in ProdPickListContract class to show the options for all inventory dimensions.

Suppose, we want to hide all the parameter groups from report dialog and just want to display the dynamics filters on the report. You need to modify the UIBuilder class of your report. For production picking list report, the UI Builder class is ProdPickListUIBuilder. The build method needs to be modified and the code in Bold below can be used to hide the whole parameter group from SSRS report dialog:

public void build()
{
FormBuildGroupControl grp;
grp = this.dialog().curFormGroup();
grp.frameType();
grp.columns(2);

if (this.controller().parmArgs().menuitemName() == #yourMenuItemName)
{
grp.visible(false);
}
super ();
}

To hide the dynamic filters from SSRS report dialog based on caller menu item, you need to override the following method in your controller class and return false from this method based on your condition:

showQueryValues

Override this method in your controller class and write the following code:

public boolean showQueryValues(str parameterName)
{
If (this.parmArgs().menuItemName() == menuItemOutputStr(#YourMenuItemName)
{
return false;
}
else
{
return true;
}
}

Credits: https://syedbaber.wordpress.com/2015/07/23/hiding-parameter-groups-or-dynamics-filters-on-ssrs-report-dialog-at-runtime/

Method 3:
If you use a report controler class, you can overwrite the showQuerySelectButton method and return false.


Method 4 :
If you remove the ranges from the modeled query, and add them back programmatically in the methods of the query, they also will not show up as parameters for the report.


Method 5:

contract parameters are can definately be hidden . Look at any report that uses srstmpTableMarshaller class (Pseudo tmp table report's ). or any document reports . Journal record id is generally passed from controller --> Design (via parameter value in contract class) -- >DP class.


But still it's not visible on the report. All you need to is set its property to hidden in VS.
I feel its more like issue with the usage data.
Once you set the property to hidden you need delete the report from report manager and then redeploy, remove usage data, delete records in SYSLastValue, SRSReportQuery restart Reporting services.

Method 6:

Allow dynamic filtering false and remove the dynamic parameter. redeploy the report and refresh the user cache.


Method 7:

You can also use a not defined group.
SysOperationGroupMemberAttribute(‘group_notdefined_at_classdeclaration’)

The group ‘group_notdefined….’ will not be shown on the dialog, so all its members are
invisible.

Credits: https://community.dynamics.com/ax/f/33/t/83017

https://community.dynamics.com/ax/f/33/p/155614/364546#364546


Now one of them would surely help :)

Tuesday, December 1, 2015

Conditionally hide Report Viewer buttons Ax2012

Today I was stuck in a situation where I had to disable the export button on the report viewer if the journal is not posted. After googling I got the below code which sits on the SRSReportViewer form:

private void hideExportButton()
{
    System.Windows.Controls.UIElementCollection elementLocal;
    Microsoft.Reporting.WinForms.ReportViewer   reportViewer;

    elementLocal = _AxReportViewer_Control.get_Children();
    reportViewer = elementLocal.get_Item(0);
    reportViewer.set_ShowExportButton(false);
}
Credit: http://www.agermark.com/2014/12/hide-export-button-from-report-viewer.html

You should have either different designs or menuItems for each condition to be called on the "init" method of the "SRSReportViewer" form. Add your custom code to call the hideExportButton where "_AxReportViewer_Control" is initialized.

// In case of multiple designs
    if(this.controller().parmReportName() like "*FundsTransferNoExport*")
    {
        this.hideExportButton();
    }
// In case of multiple menuitems
    if(this.args().menuItemName("*FundsTransfer*"))
    {
        this.hideExportButton();
    }

Thursday, July 2, 2015

Hide any file inside an image file

This a small steganography hack that is fun and sometime really useful,  when  you want to send some file over internet, but upload of only image  file  are allowed on that server.
First here is the definition of stenography from Wikipedia. 
Steganography   (Listen) is the art and science of writing hidden messages in such a   way that no one, apart from the sender and intended recipient, suspects   the existence of the message, a form of security through obscurity.  The  word steganography is of Greek origin and means “concealed writing”  from  the Greek words steganos (στεγανός) meaning “covered or  protected”, and  graphei (γραφή) meaning “writing”.    

In  short, when you  see the file it's just a normal image, but it has some  hidden message  inside it, or in general it can contain anything, even a  whole movie.

There  are lots of tools available for this  purpose, but we can do it using  what we already have just the command  prompt in windows.
The requirement
  • The image file
  • The file to be hidden, the zip file
  • Command prompt
The image I will be using is this


and I want to hide a Ms word file and a Pdf behind this image, Select both the file and send to a Zip file.

Steps..
  1. Place the zip file and the image in a folder , I am placing it on the desktop.
  2. Open   cmd(command prompt) and then go to the directory where both the files   are. Like for example, in this case, it's "desktop". So you might need   to type cd desktop 
  3. Now type copy /b imagefilename + zipfilename [filename with extensions], here is the image for clarity.
  4. Now   the size of the image will increase, what this is doing is simple,  just  appending the second file to the first file and that /b is to  specify  that it is a binary file.
Opening The file
After   copying, the image file size will only increase, but it can be opened   normally and no difference will be seen except the size. To open the  Zip  file, open this image with any Zip tool like 7zip, winrar, or winzip and you can find all the files there, just extract it wherever you want.