We are running into an issue with a new configurator that we’ve previously not had a problem with. We’re saving the Inputs and generating a method for the created configured part. With the Save Input Values checked, this appears to execute the document rules we have twice (once for the quote, again for the part creation) - causing duplicate lines on our quote. There does not seem to be a way to prevent the rules from running upon part creation. It only gives me the option to execute upon part creation.
Within our document rules, we fire a UDMethod that adds a quote detail line for certain items that go with the configured product, but not in it. They get added twice. We’re unsure how to prevent it. I saw in the document rules condition you can execute upon part creation. So I thought maybe its executing on part creation in addition to the quote configuration… but did not see the opposite type of condition.
I’m not sure that it would count as a reconfigure, but you could wrap the execution of your UDMethod in an if statement with the SystemFunctions.IsReconfigure() method:
if ( !SystemFunctions.IsReconfigure() )
{
UDMethods.AddMyQuoteLines();
}
If that doesn’t work, I’d add something to your UDMethod to check if that line already exists:
var PartLineExists = Db.QuoteDtl
.Any( x =>
x.QuoteNum == Context.QuoteNumber
&& x.PartNum == NewPartNum
&& x.QuoteLine > Context.QuoteLineNumber ); // QuoteLine > Configured Line allows multiple configurations on the same quote.
if ( !PartLineExists )
{
// Add Quote Line Logic Here
}
That’s a good adder with the quote line number. We were stuck with the inability to have more than 1 line with the same part number on the quote. That last bit solves that. Thank you.
Glad to help! Only caveat is you need to add and configure each configurable part before you add the next configurable line. If you add the multiple configurable lines to the quote and then configure them, the added lines all end up with higher line numbers than the configurable lines, and you run into the same issue of not being able to automatically add the extra lines.
I’ve handled this for several clients. I use a similar approach that sales kits use, a parent/child relationship. I usually add a new user defined field that can store a line number.
When additional lines are added the “child” field is populated with the parent’s quote line.
When document rules runs check to see if there are any “children” lines connected to the current quote line, if there are you can update them or delete them and re-add. If none found you can safely add new lines.