I’m trying to customize Quote Entry so that when people change the QtyNum field in the QuoteQty box, the QuoteQty.DocUnitPrice field does not revert back to the default. Using BPMs to set a custom field with the user-input value and then re-populating the DocUnitPrice field after changing the QtyNum value is what I’ve been trying, but I can’t seem to get that to work. I know a tiny little bit of C# and I suspect that’s the solution, but I don’t know the syntax involved with Epicor’s using assemblies and method directives. Does anyone know how I could make this happen?
I haven’t messed with the QuoteAdapter much but if you are talking about handling this on a screen you may not even need to touch adapters.
If the value you want is already in your field (a textbox) and you want to keep that field the same. You could potentially just use BeforeAdapterChange and AfterAdapterChange (select the QUoteDtl table and DocUnitPrice field)
below // Add Custom Module Level Variables Here ** add:
decimal MyDocUnitPrice;
before code
{
MyDocUnitPrice = (decimal)args.Row[“FieldName”];
}
after code
{
args.Row[“FieldName”] = MyDocUnitPrice;
}
Basically before it changes it gets the value, after it changes, it reverts it back.
I’m sure there are better way but I like I mentioned, I’ve never touched a QuoteDtl
That sounds like it will definitely work, once I figure out how to type it correctly! I tried to guess what the proper syntax would look like, and the result was this:
decimal MyDocUnitPrice;
private void QuoteQty_BeforeRowChange(EpiRowChangingArgs args)
{
MyDocUnitPrice = (decimal)args.CurrentView.dataView[args.CurrentRow]["DocUnitPrice"];
}
private void QuoteQty_AfterRowChange(EpiRowChangingArgs args)
{
args.CurrentView.dataView[args.CurrentRow]["DocUnitPrice"] = MyDocUnitPrice;
}
“Test Code” doesn’t return any errors, but the above code doesn’t appear to be doing anything, either. I’m not sure which parts of the code you gave me I’m supposed to change, and which parts I’m not supposed to change.
In cases like this use MessageBox.Show(“Your message”) to debug.
In this case in afterrow try
{
MessageBox.Show("old “+MyDocUnitPrice.ToString() +” new "+ ((decimal)args.CurrentView.dataView[args.CurrentRow][“DocUnitPrice”] ).ToString());
}
It looks you used RowChange vs FieldChange. In that case, any change to any field will cause it to grab the MyDocUnitPrice which seems like it wouldn’t work.
@josecgomez Give this guy some accurate advice
Optionally you still might be able to get a BPM to preserve your value too.
Here are a couple screen shots of a simple example I used to preserve operation comments when the Vendor is changed on a subcontract op.
I tried that BPM and couldn’t get any results. Quote Entry REALLY doesn’t want to cooperate with me.
I changed the “Before/AfterRowChange” lines to “Before/AfterAdapterChange” :
decimal MyDocUnitPrice;
public void Quote_BeforeAdapterChange(EpiAdapterChangingArgs args)
{
MyDocUnitPrice = (decimal)args.Row["DocUnitPrice"];
}
public void Quote_AfterAdapterChange(EpiAdapterChangingArgs args)
{
args.Row["DocUnitPrice"] = MyDocUnitPrice;
}
…And now I’m getting this error:
Error: CS0246 - line 28 (806) - The type or namespace name ‘EpiAdapterChangingArgs’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 33 (811) - The type or namespace name ‘EpiAdapterChangingArgs’ could not be found (are you missing a using directive or an assembly reference?)
Is there a resource somewhere that will teach me the proper syntax for coding in Epicor? I feel like I’m just making blind guesses. Also I’ll do the messagebox debugging thing too once I get the error messages out of the way, that’s a really good idea.
I’m pretty sure it’s respectively:
BeforeAdapterMethodArgs
AfterAdapterMethodArgs
HOWEVER - Those methods do not give access to a Row.
You will need to use BeforeRowChange and AfterRowChange.
Is there a resource somewhere that will teach me the proper syntax for coding in Epicor? I feel like I’m just making blind guesses.
Haha welcome to the club I use ILSpy to crawl the source and disseminate what’s supposed to happen.