Shizar115
(Shizar)
October 17, 2023, 8:01pm
1
Hi Epicor Community,
I need to keep this button on the UD01 form disabled until the user clicks on “Create New” on top left.
After that I need to make the button enabled and when user clicks on the button, it will populate some fields such as “Entity Name”.
Is it possible to do something like this?
jgiese.wci
(Joshua Giese)
October 17, 2023, 8:13pm
2
Yes very. All standard tooling in Epicor. For the button disable easiest path is probably EpiViewNotification on initilize and set btnMyButton.IsEpiReadOnly = (args.row < 0 || !args.dataView[args.Row][“RowMod”].Equals(“A”)) something to that effect could work fine. Then the button search the wizards will generate for.
2 Likes
Shizar115
(Shizar)
October 17, 2023, 11:50pm
4
This worked great @jgiese.wci ,
Thank you for your response
This is what I used :
public class Script
{
EpiButton btnKeyField;
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
private EpiDataView edvUD01;
// 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.edvUD01 = ((EpiDataView)(this.oTrans.EpiDataViews["UD01"]));
this.edvUD01.EpiViewNotification += new EpiViewNotification(this.edvUD01_EpiViewNotification);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
btnKeyField = ((EpiButton)csm.GetNativeControlReference("396fa637-4e28-4651-9587-800569e5788f"));
btnKeyField.IsEpiReadOnly = true;
// 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.edvUD01.EpiViewNotification -= new EpiViewNotification(this.edvUD01_EpiViewNotification);
this.edvUD01 = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void edvUD01_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))
{
btnKeyField = ((EpiButton)csm.GetNativeControlReference("396fa637-4e28-4651-9587-800569e5788f"));
btnKeyField.IsEpiReadOnly = false;
}
}
}
}
1 Like