Duplicate Quote - Salespeople removal and Task List Set

delete it now

I’m late to this discussion, but we have a mechanism to make every new quote have the one and only SalesRep be the current user. It first uses a Pre-Processing BPM on Quote.Update to set a CallContectBPMData field to the current user. Then, in a Quote Entry Customization, after the Quote.Update is run, it runs custom code in an AfterAdapterMethod to delete SalesReps that are not PrimeRep from the DataView, then change the SalesRepCode for that one remaining row to the CallContetBPMData string. I had help from Epicor’s Rich Riley many years ago to get this to work, and I barely understand why or how it does work. I think because of the weirdness that you are seeing in the Update method, we couldn’t make the change in a post processing BPM, we had to do it in the client. Not sure if this is appropriate for your current needs or not, but I would be happy to provide screen shots and code if asked.

Thanks Andrew. Brian is close to having something completed. I had @hkeric.wci mention the need to use UpdateExt in the post processing BPM of Quote.DuplicateQuote and also to use GetByID at the start and end of the BPM.

I wanted to work on this one more time with Brian, but he may go with what he came up with today.

Would be interesting to see your code though to see how you and the great Rich Riley did it.

So with a bunch of guidance from @utaylor (Utah also gave credit to @hkeric.wci) we used 2 Post Processing method directives on the Business Object DuplicateQuote. The first method directive resets the task list and changes the Primary Salesperson to the default record.
Haso said to always start directives with GetByID and also end with GetByID. This (I think) refreshes all of the fields properly so that the User Interface shows all the selections properly.

The Variables we used were:

We created the EXT variable like this (the error messages help us diagnose but are not necessary to run this properly):

For the Update table by Query, we pulled the data from the TableSet.

When we configured the mapping, we did the following: Bind automatically, but changing these:

We also forced the RowMod to Update:

To clear the Primary Sales Rep we used another Update table by query widget using a Table Criteria of Prime Rep = true:

Then we Changed the primary sales rep to the default (so we could eventually delete all others; because you cannot delete a primary sales rep)

Then we used two fill table by query widgets. One for QuoteHed and one for QSalesRP, binding everything automatically, except for RowMod forcing a “U” update on the QuoteHed (letting binding everything automatically on QSalesRP).

Then we added the Invoke BO ERP.Quote.UpdateExt and created the Variable EXT.

Then we copied the GetByID (to refresh the User Interface, I think).

Then on the second Method Directive (a second directive was needed because each directive can write to the database only once; before we did this we would get an error saying delete of the Primary salesperson is not allowed).


We deleted all of the sales reps that were not the default (that we previously made the new Primary). And per @hkeric.wci, we have used GetByID at the start and end of this directive also.

2 Likes

Glad we could figure something out and thanks for documenting it all for the forum!

1 Like

That is a great description of your whole process. Thanks for documenting it.
My technique was created in Epicor 9 before widgets existed, and required 2 BPMs and custom code in a Quote Entry customization. It was upgraded to Epicor 10 and further tweaked by me to get it to work. But, I think the solution described here by BKen is much clearer and concise. I may try to replace my customization with these two BPMs in the future.

1 Like

So my two Method Directives on Duplicate Quote do work to reset the task list, change the current stage, change the primary salesperson, and clear out the other Salespersons, however, the First Task is Assigned to the previous Salesperson (even though that individual is not even in the list of Salespersons).

I ran a trace when manually changing the “Assigned To” on the first task.
The Update method is used with Erp.Proxy.BO.TaskImpl to make this change.

So can that change be made from the Duplicate Quote Method directive? If so, how?

If not, will I have to create a Method or Data Directive for Task? If so, what widget would limit this action to only occur when the DuplicateQuote method has been employed?

Is the assigned to field available to you in the same directives that you have set up to change the current stage and the primary salesperson?

Maybe…? I am not sure what you mean by Available. This BPM is on Post-Processing “DuplicateQuote” method, so we were using many “Fill table by Query” and “Update Table by Query” widgets and then Invoking BO Methods.

The “Assigned To” is DB Field: Task.SalesRepCode. Running a trace while Manually Updating this record resulted in an Update on BO.TaskImpl.

Primary Salesperson is in QSalesRP.SalesRepCode.

Current Stage is in Task.CurrentStage

I think my issue lies in my Update table by Query because when I create a message showing my UpdExtTaskTableset, I see all the column headers, but I do not see any data.

What is the TaskCnt table used for?
There are only 11 columns of data:
image

I noticed that the PerConLnkRowID is unique, but the BPM won’t let me set the variable of “System.Guid” type.

This table does shows up twice (in the parameters of the Update Method of BO.TaskImpl in TaskDataSet) on a trace if I show Full Dataset (but not for show changes only). The first time it shows the “old” SalesRep and the second time it shows the “new” (intended) sales rep, but the duplicated quote still shows the “old” SalesRep.

Brian, I can’t help right now :frowning_face:

I am goign to say, change the assigned to using the trace you figured out and let the system do the changing of the rest of the related tables. The hard part is, there are business logic rules around who can do each task type so you’d have to ensure that you are playing by those rules when you assign the person otherwise when they go to complete the task, it will be read only and they won’t actually be able to complete it. In other words, I think it lets you assign whoever you want, but they might not have the permissions needed to complete the task.

You’re getting into the thick of tasks my friend, god speed.

So now I have added a 3rd Post-Processing Method Directive on Erp.BO.Quote.DuplicateQuote.

The 3rd directive reassigns my active task (I am not sure why it did not work when I tried to make this occur in the existing directives).

It is a pretty straightforward directive:
image

The condition just ensures that the user is not in our parts group. The Set Variable gets the new quote number in string format. The Task GetByID fills in the TaskTS tableset:

The Update table by Query uses the ERP.Task table with 3 criteria:

The mapping configuration looks like this:


And don’t forget to set the RowMod to “U”

The the configured parameters in the Task.Update method look like this:

I think the issue I was having was I was trying to use the Task.UpdateExt and it was not executing the change to the Assigned To of the Task. When I switched to Task.Update it worked for me.

1 Like