Data Directive to Auto Populate multiple fields based on User Group

I am trying to use an in-trans Data Directive on QuoteDtl. I want to set the initial values on some epiComboBoxes when a user (of a particular group) is creating a new line on a quote. One drop down box is Sales Category and the other is a User Defined field. You may ask why I want to pre-populate required fields, but I only want to do that for our Parts department (because they process high quantity of multi-line quotes and orders) because their sales category will always be Part and the industry will be Parts (and this would streamline their process). For our equipment department, there are multiple Sales Categories (and we will require that one be selected) and the Industries must also be selected. (tangent warning: I wanted to check that both of those drop-down boxes were populated when someone tries to click the Quoted check box, but I could not figure out the Right BO to trigger the check at the correct time).
Here is my set-up. I think I am doing everything correct, but I suspect I have something small wrong, and my lack of experience does not provide me the wisdom to identify the issue.
Here is the Condition in my in-trans data directive (checking if the user is a member of one of two particular groups). One thing that confuses me is that the condition statement mentions Method, even though this is a data directive (not a method directive):

Here is my expression for my first Set Field. I am setting my Sales Cat to PART (this is the Sales Cat code):

Here are the available options for Sales Cat:

My second Set Field is for my User Defined Field:


Here are the User Codes that are available for Industry_c:

So where did I go wrong? Is it in the Set Field formula (do I need single ’ or double " quotes or none at all)? Is it using the Code in lieu of the description? Is it the Or statement on the Condition? Can I not use two consecutive Set Fields? Should I have used a pre-processing Method Directive (for GetRow)?

The best place to default values is in Post-Processing of the GetNewQuoteDtl method.

@Jason_Woods thank you for the reply. I am a novice, so can you elaborate? I would think that to set default values, I would want that on a pre-processing Method Directive, and to check for required values I would want that to happen on a post-processing Method Directive. I don’t want the “check for required fields” to happen before the user has had a chance to populate the required fields. I want to give them a chance to enter the right data, but if they miss it and save or try to leave the record, they will get an error.

For example, we require the Product Group field (in extended properties) and real parts will have a product group entered, but parts on the fly kick the Business Logic Error immediately after you tab off the Part field.
PartOnTheFlyRequired
So, to provide a better user experience, should I uncheck the Required box on the Extended Properties for Product Group and use a post or pre processing method directive on GetNewQuoteDtl to check the condition if Product Group = “”?

These always trip me up, so I end up doing lots of trial and error… Have you tried using “… of the added row …” ??

edit

Wait … A DD won’t fire until the record actually exists or is about to be created. And that only happens after the line in the UI is saved. So that wouldn’t show in the UI until after you saved, and then refreshed.
go with @Jason_Woods suggestion.

You are asking multiple questions, but I will try to help. If you use the Update method, you would want to check values in Pre-Processing (before the Update occurs). However, to default values, you would want to do it when the record is being generated. We call the GetNewX method, but we would do this Post-Processing because if we did Pre-Processing, we would not have the record yet.

I did a quick test of a PostProc on Erp.Quote.GetNewQuoteDtl, and it works with one slight catch…

When I choose File -> New -> New Line, it updates the UI (enabling the PartNum field, etc…). But the Prod Group pre-fills with “None Selected”

image

Only after entering a Part Number and hitting tab, does the Prod Group dropdrown update to the value from my BPM.

image

You will need to populate the “ProdGroupDescription” (or something like that).

1 Like

@Jason_Woods was right again about populating the “Description” field.

I populated 2 fields for this Post Processing Method Directive (for GetNewQuoteDtl):

  1. Sales Cat (requires that I populate the ttQuoteDtl.SalesCatIDDescription field for the ComboBox to populate correctly and not show “None Selected”.
  2. a UD Field (is an EpiComboBox filtered on a User Code). For this I populate the Code and the Description populates the drop down box properly.

Is there a way to determine when you need to populate the description field rather than the Code?
Or is there another step that would refresh the drop-down lists?

If the result will show in the screen immediately and there isn’t an Update method first, then you likely need the Description.

Jason Woods
http://LinkedIn.com/in/jasoncwoods