I’m trying to set these three checkboxes to “false” in Time Phase Inquiry. I tried to create a method directive, but it’s giving me an error that the variables aren’t defined. Is there a better way to accomplish this??
To clarify, I want to default the “Planning Contract Info” “Transfer order instructions” and “Suggestions” checkboxes to false.
You could do it in a customization fairly easily with the code wizards. You could add an EpiViewNotification with the Form Event Wizard while in customization mode, using the dataView where those checkboxes are saved.
Then once the code is added, you would just need to change/type a few lines to the generated code:
Change the NotifyType to initialize, and add the following three lines in the if statement:
view.dataView[args.Row]["Suggestions"] = false;
view.dataView[args.Row]["TOSuggestions"] = false;
view.dataView[args.Row]["PlanContractInfo"] = false;
Wow! Amazing! It worked. But now it takes a long time to pull up a part in Time Phase. I regenerated the data model. Any ideas on that part?
Very strange, I’m noticing a slow down as well. I also notice that it’s pulling in record duplicates with this customization…not sure why. Maybe this isn’t a good idea after all…
Apparently the epiViewNotification on initialize doesn’t work as expected here. I wasn’t able to even re-check the boxes. BUT, it looks like it works normally using the “Form Load” event rather than an epiViewNotification.
If you add this event with the event wizard in the SAME customization that you have an epiViewNotification event, you can use some of the epiViewNotification code still. So you can reference that ‘edvMisc’ data view rather than having to define it again. Here’s my entire customization that seems to be working, I commented out the code in the epiViewNotification. Also added StartEdit / EndEdit lines to see if that helped the other bug, it didn’t.
extern alias Erp_Contracts_BO_PartPlantSearch;
extern alias Erp_Contracts_BO_Part;
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;
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 edvMisc;
// 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.edvMisc = ((EpiDataView)(this.oTrans.EpiDataViews["Misc"]));
this.edvMisc.EpiViewNotification += new EpiViewNotification(this.edvMisc_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.edvMisc.EpiViewNotification -= new EpiViewNotification(this.edvMisc_EpiViewNotification);
this.edvMisc = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void edvMisc_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))
{
/*
view.dataView[view.Row].BeginEdit();
view.dataView[view.Row]["Suggestions"] = false;
view.dataView[view.Row]["TOSuggestions"] = false;
view.dataView[view.Row]["PlanContractInfo"] = false;
view.dataView[view.Row].EndEdit();
*/
}
}
}
private void TimePhasForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code
this.edvMisc.dataView[this.edvMisc.Row].BeginEdit();
this.edvMisc.dataView[this.edvMisc.Row]["Suggestions"] = false;
this.edvMisc.dataView[this.edvMisc.Row]["TOSuggestions"] = false;
this.edvMisc.dataView[this.edvMisc.Row]["PlanContractInfo"] = false;
this.edvMisc.dataView[this.edvMisc.Row].EndEdit();
}
}
OK. Now it’s just crashing every time. How do I delete these form events? I’m sure I did something wrong, but I’d rather have the checkboxes checked then have it this slow and crash when we open Time Phased
Did anybody ever get this customization layer working? I just received a request to do this process.
It worked for me when I put the code you posted into a form load event. Also need to initialize that edvMisc variable:
// **************************************************
// Custom code for TimePhasForm
// Created: 1/17/2022 11:40:58 AM
// **************************************************
extern alias Erp_Contracts_BO_PartPlantSearch;
extern alias Erp_Contracts_BO_Part;
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;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
private EpiDataView edvMisc;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
this.edvMisc = ((EpiDataView)(this.oTrans.EpiDataViews["Misc"]));
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void TimePhasForm_Load(object sender, EventArgs args)
{
// Add Event Handler Code
this.edvMisc.dataView[this.edvMisc.Row].BeginEdit();
this.edvMisc.dataView[this.edvMisc.Row]["Suggestions"] = false;
this.edvMisc.dataView[this.edvMisc.Row]["TOSuggestions"] = false;
this.edvMisc.dataView[this.edvMisc.Row]["PlanContractInfo"] = false;
this.edvMisc.dataView[this.edvMisc.Row].EndEdit();
}
}