Converting Classic Screens to Kinetic... best way to default LockPrice for new OrderDtl rows?

So, after looking at it and discussing with a colleague, the desire is simply to default OrderDtl.LockPrice to true on new OrderDtl records.

Do I need a Data Rule in App Studio, or is it an event?

[Original text below]
I’m guessing this will be very easy to someone here.

I’ve been asked to convert this part of a Classic Screen to Kinetic. Specifically, the edvOrderDtl_EpiViewNotification method.

I’ve included the calling method InitializeCustomCode. I don’t really understand the classic code very much. :slight_smile:

So, the way I read this is…

if the edvOrderDtl_EpiViewNotification method is called and
if you are adding a row
then set the LockPrice to 1.0?

Which, I presume (and we all know what THAT means) might set the Price field to be read-only?

So, how would I accomplish that same feat for the same conditions in Kinetic?

Choices:

  1. Use the correct events (which ones?) and do it in App Studio (but how?)
  2. Create a C# Data Directive (but what exactly does it need to do?)
  3. Other ways?

Thanks in advance.

I realize I have so much to learn here.

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

		this.oTrans_ordAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_ordAdapter"]));
		this.oTrans_ordAdapter.BeforeAdapterMethod += new BeforeAdapterMethod(this.oTrans_ordAdapter_BeforeAdapterMethod);
		this.OrderDtl_Row.EpiRowChanged += new EpiRowChanged(this.OrderDtl_AfterRowChange);
		this.OrderDtl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.OrderDtl_AfterFieldChange);
		this.OrderHed_Column.ColumnChanged += new DataColumnChangeEventHandler(this.OrderHed_AfterFieldChange);
		this.edvOrderDtl = ((EpiDataView)(this.oTrans.EpiDataViews["OrderDtl"]));
		this.edvOrderDtl.EpiViewNotification += new EpiViewNotification(this.edvOrderDtl_EpiViewNotification);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
		SetExtendedProperties();
		// End Wizard Added Custom Method Calls
	}


[...]

	private void edvOrderDtl_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))
			{
				view.dataView[args.Row]["LockPrice"] = 1.00d;
			}
		}
	}	

I think the easiest way to default it to true would be a post processing bpm on GetNewOrderDtl (there are some variations of this method if you are creating from a quote or counter sale so you might have to add more than one).

In the bpm just set that field to true with a set field widget.

I would just do it from an OrderDtl DD.

Thank you Cory. This was exactly what I needed. I am very new to this, and the only other thing I am noting (for myself), is that after creating the BPM, I had to enable it (duh) for it to be, well, enabled.

When I tested after creating but before enabling, of course, it didn’t work.

But anyway, thank you. That was exactly the solution that makes sense to me, and that worked for me.

I definitely did that a lot when I started creating BPMs, my latest version of that is creating a function, testing it with @josecgomez’s tool, and then not being able to put it in an event or bpm because it’s not promoted.