How to add Misc Charges on a Quote per Detail Line using VB

I need to add 3 Misc Charges, per Quote Detail line after the Part Number has been selected for the newly created Quote Detail Line. I believe I know exactly the event where this needs to be coded …

Private Sub QuoteDtl_AfterFieldChange(ByVal sender As Object, ByVal args As DataColumnChangeEventArgs)
Select Case args.Column.ColumnName
Case “PartNum”

I need to know how to access the per line Misc Charge record entries for the Quote Detail Line using VB. I believe once I can access that object, I can add the 3 specific records I need.

I am tied to using VB due to a previous customization in production that is already using VB.

I have seen a post that is very similar to what I need to do using the this link, but I don’t see what which EpiDataView to use for my specific instance.

Any assistance will be greatly appreciated.

Would you be against doing it in a BPM?

The BO Quote.ChangePartNum method fires on changing the part number on the form.

Hey Calvin,

I don’t have a problem going that route if you’re referring to using a Method Directive. Would that be correct?

Up until I understood that a Part Number is required for what I needed to do, I did create a method directive to be executed when a new line was created for the quote. The issues I ran across then was trying to get the existing information I need to create the Line Misc Charge entry. Nothing was accessible from the ttQuoteHedRow table that was mapping from. I was getting an error stating the fact that there wasn’t any data in that table.

The other issue I would have to know is where to put data into the row entries I want to create. For example, my method directive was was mapping to the ttQuoteMsc table. Is that the correct table to enter Line Misc Charges or does that refer to the Quote Header Msc charges? It may not, but I don’t see anything the specifically refers to a QuoteLineMsc charge. The naming conventions used in Epicor aren’t as directly named as I would hope. Some are … some aren’t.

Again, I’m learning this environment. Sorry for asking questions that may seem painfully obvious to you and those out there in the Epicor community.

Thank you for taking the time.

Hi Keith,

I believe you’re looking for QuoteMsc, since you want to add yours as a miscellaneous line charge. I was adding mine as a miscellaneous header charge so I was using QuoteHedMsc.

image

Ok. Thank you.

Line Misc Charges are stored in QuoteMsc, Header Misc charges are in QuoteHedMsc.

I’ve only dabbled in creating records with BPM’s, but there seems to be quite a few examples on here.

And doing it on the ChangePartNum method would make it so that the BPM isn’t fired a lot. It would be just once each time the line has a PartNumber assigned (or changed)

1 Like

Are you using a Post-Process Method Directive? Are there other directives on the method you’re using? If so, try disabling them and then testing your BPM. I had a similar issue on a previous project, table being empty, that was being caused by a directive someone else had created before me. They were clearing the tables at the end of their script. Took me almost an entire day to figure out why my directive wasn’t finding data.

That would be frustrating … To answer you questions, yes, before I was using a Post-Process Method Directive, which is one of the reasons I thought it was strange that the existing (parent) data wasn’t accessible.

If I can get the Quote.ChangePartNum to work, it would still be a post-process method. There is another customization using the Quote.ChangePartNum but it’s a Pre-Process directive and it’s not removing any data I would need.

1 Like

Ok, everyone is correct that I use the QuoteMsc and to use the ChangePartNum method to add my new default Misc Charge per Line records. Visually, the process looks like it works however the results to not behave as if these records were added via the system selecting the “New Line Specific Charge” menu option.

  1. When my entries are made, clicking save does not reflect them in a QuoteMsc file dump.
  2. When attempting to edit one of my entries, an error message indicated that SysRowID is empty, [00000000-0000-0000-0000-000000000000].
  3. When deleting one of my record entries results in all of them being removed at one time.

So … they’re there … but they’re not there.

I’ve been advised, and am currently looking at trace transactions to see what the difference is between my method directive and when performing the entries manually via the system. I am finding some differences, but it’s not really obvious of what is really happening that I can used to correct my process. I really believe it has something to do with the missing SysRowID value…however I would think that would be a system value that is maintained by the system. I’m surprised, in my case, it isn’t.

I’ve recently added an “A” to be mapped to the RowMod field. After doing that, I’ve been getting more issues that I wasn’t before. For instance, now my Misc Charge entry doesn’t recognize the ‘Line’ value just created even before the PartNumber is entered. This is really getting confusing.

Where do I get the Existing Quote value when I use my directive to add the Misc Charge entries After the PartNum has been entered/changed? I get a message that states, “There are no records in the table ttQuoteHed.”

Just as a little bit of an update, I was able to find how to produce a GUID value for the SysRowID. There is a function available does just that. It creates a new GUID value. the syntax is:

  Guid.NewGuid()

This is available in the expression builder of a BPM when mapping.

So … that works, but my QuoteMsc values are not being saved with the quote. Any ideas or direction would be extremely helpful.

Ok, it looks like I’ve been able to fill the dsQuoteMsc dataset with the 3 specific Misc Charges (per Quote Detail Line) as the grid displays the 3 records I’ve automatically added via BPM. But, the records aren’t staying with the quote. After my directive executes and the records are added, pressing Save does not show those records when the Quote is reloaded. What am I missing?

Is there an Update process that needs to be executed after each record is added? I know I’m extremely close to getting this to work … but I feel like I’m missing something so obvious I can’t see what’s right in front of my face.

Any suggestions are welome!