# Auto Toggle Make Direct Sales Kit line

**URL:** <https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994>\
**Category:** Epicor ERP 10\
**Tags:** dmt, dashboard, ubaq, e10, bpm\
**Created:** [November 1, 2022, 3:44pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994 "2022-11-01T15:44:02Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 3:44pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/1 "2022-11-01T15:44:02Z")

</div>

I have a working BPM that changes a sales kit line release to be Make Direct that I built using this post:

> [@Auto Check "Make Direct"](https://www.epiusers.help/t/auto-check-make-direct/65816):
>
> I have a BPM that I thought was working, but appears to be causing some glitches. The intent is if there are certain parameters in the Part Master met, that when the line in a sales order is created, it would automatically check “Make Direct” as override since it’s not the default. I have an In-Trans Data Directive on the OrderRel table that checks if a release was added and that the parameters are met and marks the box appropriately. However, for those releases, the Planning Workbench is sug…

I am aware that toggling the Make flag does not carry out the methods that happen when you manually check/uncheck the flag in the UI. _ **What, if anything, do I need to “undo” when marking Make Direct false programmatically?** _

Back story if you care…  
I have much appreciation for those (@hmwillett , @timshuwy , @Randy) who covered how to automatically enable the Make Direct flag on an order and properly drive suggestions, etc. However, I have a business case that I want to undo this selectively. Long story short, we started using sales kits in some instances but we want to treat the manufactured lines in the sales kit like a make direct line 98% of the time. That part is working fine. But occasionally we end up with a unit in stock (that is not normal) and they want to use that to fulfill the line on the sales kit. Today, I have to disable the BPM and use the DMT to toggle the Make flag to false and let them reserve/allocate before re-enabling the BPM. This seems to work OK but I don’t want to have to be involved for these scenarios. So I thought I could create a UBAQ to do this and give it to the sales people to toggle the flag. I’m having some trouble getting the PartSug and PartDtl to sync up with these changes like they need to. Upon a new row added, everything works properly. But changing an existing row, I am expecting a suggestion to exist in the PartSug table to create a job and it’s not happening. Worse, if I toggle it back to true, my original PartSug entry tied to the order doesn’t come back either. It seems like changing the Make flag doesn’t stick either and it is getting changed back after I force it. I seem to recall that’s why I used the DMT in the first place… the change would stick. Any ideas?

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [November 1, 2022, 3:49pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/2 "2022-11-01T15:49:10Z")

</div>

It’s kind of a mess and been a few years since I looked, but if you do it without the BO, you have to keep the OrderRel, PartSug, and PartDtl tables in sync. Maybe PartWip too (don’t remember).

I don’t recall what the issue was when I used the BO SalesOrder.ChangeMake, but if you can get that to work, I would start there as it should cover all of that for you.

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 3:50pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/3 "2022-11-01T15:50:45Z")

</div>

I should probably put more effort into getting the ChangeMake method to work first. I agree. I am probably over-complicating things.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [November 1, 2022, 3:58pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/4 "2022-11-01T15:58:32Z")

</div>

Question, are you only making sales kits make direct or all of your parts?

---

<div class="post-metadata">

**Author:** ![hkeric.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/hkeric.wci/32/52019_2.png) [@hkeric.wci](https://www.epiusers.help/u/hkeric.wci)\
**Post date:** [November 1, 2022, 3:58pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/5 "2022-11-01T15:58:58Z")

</div>

I can tell you what logic I used to make Unfirm on Order Entry be set properly, especially related to Kits. Now in my case there wasn’t a need for a BO and the BO may handle Kits for you. But if the BO doesn’t then you are still responsible to updating the Children.

 ![image](https://www.epiusers.help/uploads/default/original/3X/5/d/5d580c0c384a2940a6bfe3658923f053511da0cf.png)

```cs
if (IsOrderCreditHold(iOrderNum))
{
  foreach (var ttOrderRelRow in ttOrderRel.ToList())
  {
    using (var txScope = IceContext.CreateDefaultTransactionScope())
    {

        var row = Db.OrderRel.Where(w => w.Company == Session.CompanyID && w.OrderNum == ttOrderRelRow.OrderNum
                && w.OrderLine == ttOrderRelRow.OrderLine && w.OrderRelNum == ttOrderRelRow.OrderRelNum).FirstOrDefault();

        row.FirmRelease = false;
        ttOrderRelRow.FirmRelease = false;
        Ice.Diagnostics.Log.WriteEntry($"[Updating FirmRelease] OrderNum: {row.OrderNum} - OrderLine: {row.OrderLine} - OrderRel: {row.OrderRelNum}");
        Db.Validate(row);

        var kitChildrenRows =
          (from od in Db.OrderDtl
            join or in Db.OrderRel on new { od.Company, od.OrderNum, od.OrderLine } equals new { or.Company, or.OrderNum, or.OrderLine }
            where od.Company == Session.CompanyID
              && od.OrderNum == ttOrderRelRow.OrderNum
              && od.KitParentLine == ttOrderRelRow.OrderLine
              && or.OrderRelNum == ttOrderRelRow.OrderRelNum
              && od.KitFlag == "C"
            select or
          ).ToList();

          foreach (var kitChildRow in kitChildrenRows)
          {
            kitChildRow.FirmRelease = false;
            Ice.Diagnostics.Log.WriteEntry($"[Updating FirmRelease Kit Child] OrderNum: {kitChildRow.OrderNum} - OrderLine: {kitChildRow.OrderLine} - OrderRel: {kitChildRow.OrderRelNum}");
            Db.Validate(kitChildRow);
          }
          
          
          Ice.Diagnostics.Log.WriteEntry($"DEBUG LISTING ALL");
        var kitChildrenRowsx =
          (from od in Db.OrderDtl
            join or in Db.OrderRel on new { od.Company, od.OrderNum, od.OrderLine } equals new { or.Company, or.OrderNum, or.OrderLine }
            where od.Company == Session.CompanyID
              && od.OrderNum == ttOrderRelRow.OrderNum
              && or.OrderRelNum == ttOrderRelRow.OrderRelNum
            select or
          ).ToList();

          foreach (var kitChildRow in kitChildrenRowsx)
          {
         
            Ice.Diagnostics.Log.WriteEntry($"[Debug] OrderNum: {kitChildRow.OrderNum} - OrderLine: {kitChildRow.OrderLine} - OrderRel: {kitChildRow.OrderRelNum}");
       
          }
          
        txScope.Complete();
    }
  }
}

```

In my case I had to do it on the POST After Credit Hold was applied, hence UI Refresh.  
 ![image](https://www.epiusers.help/uploads/default/original/3X/1/6/165996d0ae8bf68d5a0a841e16ffea53c56457d2.png)

**Definitely:** Go with ChangeMake

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [November 1, 2022, 4:01pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/6 "2022-11-01T16:01:57Z")

</div>

Would love to see the refresh UI code…

---

<div class="post-metadata">

**Author:** ![timshuwy](https://www.epiusers.help/user_avatar/www.epiusers.help/timshuwy/32/90122_2.png) [@timshuwy](https://www.epiusers.help/u/timshuwy)\
**Post date:** [November 1, 2022, 4:13pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/7 "2022-11-01T16:13:03Z")

</div>

I am having trouble getting my head around a “make direct sales kit”… how does that work? Sales Kits are not normally made on a job and if you ship the kit from a job, then the components of the kit would not be properly shipped.

---

<div class="post-metadata">

**Author:** ![hkeric.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/hkeric.wci/32/52019_2.png) [@hkeric.wci](https://www.epiusers.help/u/hkeric.wci)\
**Post date:** [November 1, 2022, 4:13pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/8 "2022-11-01T16:13:06Z")

</div>

If you do a simple **GetByID** in the POST Epicor will handle the Refresh for you. I started doing that going forward.

It just does this

```cs
using (Erp.Contracts.SalesOrderSvcContract orderSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
{
  SalesOrderTableset OrderDs = orderSvc.GetByID(iOrderNum);
  this.dsHolder.Attach(OrderDs);
}

```

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 4:19pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/9 "2022-11-01T16:19:34Z")

</div>

We are moving toward stock but for the time being, almost all Manufactured parts are Make Direct - save for some kanban items do as needed.

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 4:26pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/10 "2022-11-01T16:26:55Z")

</div>

I know. It’s ridiculous.  
Our company has a long tradition of tying jobs to customers. So we have done mostly make direct for manufactured parts. However, we have a diverse customer base and several of them require us to supply 1 part number for their PO as a complete “kit”. For years, we would make a custom part number with a customer specific MOM - usually consisting of a copy of a standard part but with a few extra options/accessories lumped in. This skewed finances and eventually caused finance to have to make adjustments for those transactions because all the revenue was coming in on one product group instead of splitting to the various groups. That’s where the sales kit came in. But of course sales kits don’t do make direct jobs. And we started out by not tying them to customers. But everyone couldn’t figure out which was which and after briefly trying to trick our dashboards into tying an order to the job (even when it was stock), I set out to try to make the sales kit direct. So it works by tricking the system into making the release directly to the order but then I also have a BPM on the backside that when the operation is reported complete, it will change the demand link back to stock just in time for it to be picked for shipment.

---

<div class="post-metadata">

**Author:** ![timshuwy](https://www.epiusers.help/user_avatar/www.epiusers.help/timshuwy/32/90122_2.png) [@timshuwy](https://www.epiusers.help/u/timshuwy)\
**Post date:** [November 1, 2022, 4:36pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/11 "2022-11-01T16:36:44Z")

</div>

Ahh… the old “Manufacturing wants to know who they are making it for” trick… Years ago I had to remove the customer and order information from our production reports, travelers, etc, because we had to stop the shop from prioritizing certain customers “because they are more important”. It seemed that the production line thought they knew better than the planners, and would override their decisions to make one item ahead of another.  
My view is that production should make what they are told to make BY PART NUMBER and not by customer or order.  
FYI… at Epicor, our developers do not know which customers are asking for a feature. All they know is that someone in Product Management said that we need a feature, and they produce it.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [November 1, 2022, 4:44pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/12 "2022-11-01T16:44:14Z")

</div>

> [@dr\_dan](#):
>
> almost all Manufactured parts are Make Direct

Why not set the default to make direct at the company level then?

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 4:51pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/13 "2022-11-01T16:51:14Z")

</div>

Will that work for a sales kit?

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [November 1, 2022, 5:09pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/14 "2022-11-01T17:09:20Z")

</div>

Thanks Haso, I think @hmwillett is using that in kinetic as well.

---

<div class="post-metadata">

**Author:** ![Randy](https://www.epiusers.help/user_avatar/www.epiusers.help/randy/32/51539_2.png) [@Randy](https://www.epiusers.help/u/Randy)\
**Post date:** [November 1, 2022, 5:56pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/15 "2022-11-01T17:56:48Z")

</div>

> [@timshuwy](#):
>
> …because we had to stop the shop from prioritizing certain customers “because they are more important”. It seemed that the production line thought they knew better than the planners…

Not to derail the thread, but welcome to my struggle. 😉

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [November 1, 2022, 5:57pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/16 "2022-11-01T17:57:51Z")

</div>

Oh God–giving me PTSD from my time as a planner. Looking at you BOBBIE. 😑

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [November 1, 2022, 7:23pm UTC](https://www.epiusers.help/t/auto-toggle-make-direct-sales-kit-line/95994/17 "2022-11-01T19:23:12Z")

</div>

OK. Questionable business process practices aside, I was able to get the ChangeMake method to work on my UBAQ so I think I’m good to go. I ended up doing a pre-processing on the Update method and sent the values to callContext variables and enabled a post processing directive. Then on the post-processing I ran the ChangeMake and MasterUpdate methods to implement the change. Seems to work OK. Thanks everyone!!
