Set Routing options to False with a customization

Hello guys i would like to set the routing on the print screen as false when the screen load. i already have a code but it is not working could you please let me know what is wrong in my code. Thanks

private void ARInvForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code

	EpiDataView reportparam = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
	reportparam.dataView[reportparam.Row]["SSRSEnableRouting"] = false;
	
}

The code is fine but you will want to do something like this or narrow it down further (sample only). When the report style changes this would catch that change as well.

	private void edvReportParam_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
		{
			if ((args.Row > -1))
			{
			EpiDataView reportparam = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
			reportparam.dataView[reportparam.Row]["SSRSEnableRouting"] = false;
			}
		}
	}

I dont understand you. I am sorry. because i want that routing be = false for any invoice that is printed.

The code you have to change the routing to false will work but needs to be in another event (EpiViewNotification) to really do what you want. If you add this event and the code it will disable the routing. Basically, by doing within this event you can make sure the report params is not populated again overwriting the desired false routing.

Dan, I tried what you told me placing my code in EpiViewNotification and it didnt work (I clear cache and close epicor and open it back up just in case)

private void edvReportParam_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row][ā€œFieldNameā€]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
{
if ((args.Row > -1))
{
EpiDataView reportparam = (EpiDataView)(oTrans.EpiDataViews[ā€œReportParamā€]);
reportparam.dataView[reportparam.Row][ā€œSSRSEnableRoutingā€] = false;
}
}
}

Change from AddRow to Initialize

I change that line and nothing

Can you paste in your full code from the script editor?

// **************************************************
// Custom code for ARInvForm
// Created: 2/25/2018 12:48:23 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win.UltraWinToolbars;

public class Script
{
// ** Wizard Insert Location - Do Not Remove ā€˜Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **

private EpiDataView edvReportParam;
// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	//this.edvReportParam = ((EpiDataView)(this.oTrans.EpiDataViews["ReportParam"]));
	this.edvReportParam.EpiViewNotification += new EpiViewNotification(this.edvReportParam_EpiViewNotification);
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	// End Wizard Added Custom Method Calls




	
}

public void DestroyCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	// Begin Wizard Added Object Disposal

	this.edvReportParam.EpiViewNotification -= new EpiViewNotification(this.edvReportParam_EpiViewNotification);
	//this.edvReportParam = null;
	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

//private void ARInvForm_Load(object sender, EventArgs args)
//{
	// Add Event Handler Code

	//EpiDataView reportparam = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
	//reportparam.dataView[reportparam.Row]["SSRSEnableRouting"]  = false;
	//string toolbarNames=string.Empty;
	//foreach (UltraToolbar toolbar in baseToolbarsManager.Toolbars)
	//{
	//	if(toolbar.Key == "_utbOutputFormat")
	//		toolbar.Visible = false;
	//}

//}

private void edvReportParam_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// ** Argument Properties and Uses **
	// view.dataView[args.Row]["FieldName"]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	
	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{
		if ((args.Row > -1))
		{
			EpiDataView reportparam = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
			reportparam.dataView[reportparam.Row]["SSRSEnableRouting"]  = false;
		}
	}
}

}

Test.xml (7.3 KB)
Can you import this customization and try it? From a glance not seeing anything above wrong with the code. This has a message box to show the value for the routing. Are you testing this while in developer mode?

the customization returns false but then i hit OK the print screen comes back with the routing flag = true

You are opening Invoice tracker - selecting an invoice - and then selecting print, correct? The customization is then in the print dialog screen and that should not be returning true. Assuming there are no other conflicting items such as a BPM this should not happen.

I found something if i set the flag to false and i hide through code the toolbar then the routing stay off but finance needs the tool bar to be visible so the just use the routing whenever they want. I try to change toolbar.visible = false to = true and i got the same problem the routing goes back to be true

what you describe is true i open invoice tracker i load an invoice then select print and the customization does not work.

Gotcha - the code assumes the default report style is not the routing style, which is not the case for you since the checkbox is being selected right away. Give me a minute and I will send you a way around that.

Thanks so much i really appreciated i will wait

Try this and remove the other code you had (reportparam.dataView[reportparam.Row][ā€œSSRSEnableRoutingā€] = false). Here is example Example.xml (5.0 KB) @Alex let me know if this works for your requirements.

Add – using Infragistics.Win.UltraWinToolbars;
Then in form load add this.

StateButtonTool myButton = null;
myButton = (StateButtonTool)baseToolbarsManager.Tools["_sbtRouting"];  
myButton.Checked = false;
3 Likes

Sharing our solution to a similiar challange. The afformentioned solution will uncheck the box but will not keep the StateButtonTool unchecked if a user selects a different report style or output.

The attached solution maintains the unchecked state of the StateButtonTool : a user selection is made, the Routing is disabled for the selected report style and/or output.

I’m grateful for the effort above for us being a step further than we would have been. Much appreciated.

Routing_PO_Invoice_Checkbox.txt (3.0 KB)