Setting Defaults in quick job

I’m trying to set a default value on a field with a pull-down (The “Warehouse” field in Quick Job Entry) but I don’t see a “Customize Tracker View” in the context menu, presumably because it’s not a tracker. How do I set a default in this case?

I tried going to “Customize” and setting the text for the field, but that seems to just set the current text, saving the customization and then restarting the screen also clears out the default text I just tried to save.

When I go to field help under technical details I also see there is an “Initial Value” field, but I can’t change that either.

I don’t know if the fact that it’s a pulldown pulling values from another table makes it any more complicated or not.

Once I get into this function to do the assignment, how do I know the name of the variable I am assigning to? In the above example, “dteCalculated_LoadDate.Value” is used, but for the field I am looking at I’m not seeing anything resembling that. I’m sure there’s a better way to do this than guess at names, save the customization, then quit the screen and restart it to see if there is a compiler error… :slight_smile:

I can also get a reference to the native control, which in this case is a Erp.UI.Controls.Combos.WarehseCombo, by calling csm.GetNativeControlReference(GUID), but I’m not sure how to use this to set the field value either. Haven’t found any documentation on this object in the customization user guide…

Did you look in the object explorer and see what’s in the data view? Generally it’s best to set values there.

1 Like

I think it is easeier to creat a Post-Processing Method Directives on Erp.QuickJobEntry.GetNewQuickJob

And Set the field of the changed row for both ttQuickJob.WarehouseCode and ttQuickJob.WarehouseDesc to the default you want.


I have been in the object explorer, but I’m not sure what you mean by “set values there”.

I have looked at the example code but I must be doing something wrong somewhere because it’s not working. I’m assuming that WarehseCombo is a sub-class of EpiCombo (that’s the closest Controls object I can find under the UI Objects tab), and it shows both “Text” and “Value” properties. I’m copying the form of the C# examples it gives on the object I get back from the GetNativeControlReference, and there are no errors assigning a string to either of them, but nothing shows up in the control, either. Some possibilities I have come up with:

  1. Setting the property doesn’t automatically cause the property value to show up in the field on-screen
  2. It’s some other property besides “Text” or “Value” - there are a lot of properties to look through and I may have missed the correct one.
  3. InitializeCustomCode() is the wrong place to put the assignment.

@TobyLai I’ll look into that too… by Post-Processing though, do you mean this will happen immediately after the form gets loaded or (for a new record) ready to process input, or something that happens after the user is done? It’s the former I’m looking to do.

The object explorer lists the fields in the dataview. That can show you what you need to change. It gives you some sample code to get you started. It’s not always perfect, but it will usually get in the right spot.

Generally, if you change the dataview, the UI will follow accordingly. I you change the UI the data behind it may or may not.

Run trace and look at it as you are doing things to see which things fire when. Do one step, view the trace. Do another step, view again and see what happens. There are lots of methods that fire when you are doing things in the system, not just the one that saves things.

I don’t see anything under “Data Objects” besides “EpiDataViews” which doesn’t seem to expand into anything containing a resemblance to the UI field I want to initialize.

try expanding the dataView

Oh wow, how did I miss that… twice? :sweat_smile:

@ckrusen Haha I see how I missed it: It doesn’t always show up! I had to click on the item this time before I saw it:

Now some progress. I copied the example code into the InitializeCustomCode function and customized it. But, I want to assign to the field, not read its value and the example code doesn’t show how to do that, so I swapped the fields from:

String str = view.dataView[view.Row][“WarehouseCode”];


view.dataView[view.Row][“WarehouseCode”] = “Test Warehouse”;

Now when I start the screen I get a dialog box titled “InitializeCustomAssembly–InitializeCustomCode” saying: “Exception has been thrown by the target of an invocation.”

I’m just guessing here, but I think it didn’t like being assigned a string…

Is that really your warehouse code? Or is that the description?

Also, this is something that you need to put in an event. You can’t just put in in initialize custom code.

Check out the even wizard for epiview notification. You put you code in the brackets in the if statement.

1 Like

So if you use the wizard for that, you can use the code example from the wizard in the comments.


Change “FieldName” to the field name that you found in the object explorer.

so you end up with this

	private void edvQJ_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]["WarehouseCode"]= "GEN";

So whenever there is a new row, it will set this to your warehouse.

1 Like

I looked at the QuickJob Entry, the controls are not enabled until you create a new job. This means the Method

Erp.QuickJobEntry.GetNewQuickJob must be executed before the drop down is enable.

You can create a Method Directives BPM for QuickJobEntry.GetNewQuickJob

Set field for WarehouseCode and WarehouseDesc, then when the new Job is created, the default warehouse is selected. I prefer this way than using custom code.


I agree with @TobyLai a BPM is the better way to do it, both will work however.

Everything about this is great, except for the fact that I can’t get it to work! I have tried setting several different fields (I noticed some fields are getting automatically initialized once an actual part is entered, I was under the assumption that once I clicked on (e.g.) “New Job” any initialization would be done - Warehouse is getting initialized to “Finished Goods” and Quality is getting initialized to 0, though I don’t see any code doing this.)

There are no errors, just nothing is getting filled in the way I want. Is there some way to run this with the customizations window open so I can watch the output and maybe some way to generate output there myself for debugging purposes?

As far as I can tell I followed the steps you laid out exactly. There’s no other script code aside from what I just generated, so it’s not like an existing customization is fighting me.

Guess I’ll see if I have any better luck with the BPM approach…

All I can tell you is to run a trace and follow it like a script in a movie. It will tell you what is being set when.

I’ve got all the boxes checked and I can see the business objects being called, but I’m not really sure what I’m looking for. I’m not going to see my events called or the values I’m trying to set because they’re on the client side, right? Any extra flags I should pass to tracing?

Basically, the last thing I am seeing in the trace appears to be returning a <QuickJob> data structure… this has a <JobNum> field which is whatever job number I entered, and a <PartNum> which is whatever part I selected… but then there are a lot of other field values, for instance it is returning “FG” for <WarehouseCode> and “Finished Goods” for <WarehouseDesc>. It looks like it is returned all the (default?) values for every field, and that is what is populating the screen, not what I am telling it to in the EpiViewNotification event.

After each business object you will see the parameters of what’s being called. That’s the inputs. If the part number matters. That will be there. After that, you will see all of the columns in the data view. That’s what that business object touches. So if you want to set something, you can see with business objects you can hang a BPM on.

After thinking a bit, I bet that the warehouse is set by the primary warehouse on the part. You may not need to try and set that. So make sure you understand the base process first before you start customization.