How to hold key fields on UDxx form after clicking the New icon

I have successfully transferred the 3 keys, key1, key2 and key3 from the part form to a UD33 form on load. The 3 keys are Part number, Revision Number and a sequential form number or ECR number. See below screen shot.


When I click the New icon, the Part number and revision number get cleared. See screen shot below. I want them to stay on the form after clicking new because I don’t want the user to have to rekey the part number and revision number before hitting save. I increment the key3 by 1 using a bpm in transaction data upon add directive for UD33. Any help would be much appreciated.

Thank you,
Richard

Depends on how you loaded those 3 fields OnLoad. You should be able to do a GetNew onload then populate the appropriate EpiDataViews\fields.

Thank you for your response.
When I click on the new icon, the tree view on the left shows a new blank line and waits for the input of the part number and revision number. Those field names are:
txtKeyField2 which is bound to UD33.Key1
txtKeyField3 which is bound to UD33.Key2
I load those values with the code below during the load of the UD form.
Would you please give me the code to hold these 2 fields after clicking the new icon?
Thank you so much! Richard
private void UD33Form_Load(object sender, EventArgs args)
{
// Add Event Handler Code
var CCCData = oTrans.Factory(“CallContextClientData”);
var user = CCCData.dataView[CCCData.Row][“CurrentUserId”].ToString();
GetUD01Data(user, string.Empty, string.Empty, string.Empty, string.Empty);
EpiTextBox partnum = (EpiTextBox)csm.GetNativeControlReference(“94a00040-0d73-4dc1-b991-5fcc44e2ba37”);
EpiTextBox revision = (EpiTextBox)csm.GetNativeControlReference(“a7a2e36b-a41c-4eca-ad3e-55d231bcc095”);
string partnums = partnum.Value.ToString();
string revnums = revision.Value.ToString();
SearchOptions searchOption = new SearchOptions(SearchMode.AutoSearch) { DataSetMode = DataSetMode.RowsDataSet };
string whereClause = “Key1 = '” + partnums + “’ AND Key2 = '” + revnums + “’”;
searchOption.NamedSearch.WhereClauses.Add(“UD33”,whereClause);
this.oTrans.InvokeSearch(searchOption);
}

Depends on what you are trying to do. Are you saying EACH time you GetANew, you want those same numbers populated?

If so, OnLoad, store those values to global form variables.

Then AfterAdapterMethod (GetNew) - use your current logic to pull the values into the new row (identified as RowMod = “A”)

Hey Chris,
Thank you for your response.
I added the below code and never get the message “getnew”.
What am I doing wrong? Please help!
Thank you,
Richard
private void oTrans_adapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
case “GetNew”:
EpiMessageBox.Show(“getnew”);
break;

You’ll want to do a trace, it’s typically GetANewUDxx (where xx is your UD #)