Taylor_L
(Taylor Ley)
May 10, 2024, 3:26pm
1
Is there an easy way to make Territory Source in Customer default to Synchronize to Customer instead of System Select?
We are having an occasional issue where Epicor does not like having unassigned as the territory when it is taken from system select → get territory, and I am hoping that changing the default territory source to be synchronize with customer would stop this from happening.
I thought I could just go into application studio and change the default there, but the combo box doesn’t show anything in column or list.
Example of what I have done in the past
var ttShipToRows = ttShipTo.Where(w => w.Added()).ToList();
foreach (var row in ttShipToRows)
{
// Get TerritorySelect Setting
string sTerritorySelect = Db.XaSyst.Where(w => w.Company == row.Company)
.Select(s => s.DefaultShipToTerritorySelect_c)
.DefaultIfEmpty("SYST")
.First();
row.TerritorySelect = !string.IsNullOrEmpty(sTerritorySelect) ? sTerritorySelect : "SYST";
// If the TerritorySelect is not SYST we need to get the TerritoryID from Customer
if (sTerritorySelect == "SYNC")
{
row.TerritoryID = Db.Customer.Where(w => w.Company == row.Company && w.CustNum == row.CustNum)
.Select(s => s.TerritoryID)
.DefaultIfEmpty("")
.First();
}
}
2 Likes
Taylor_L
(Taylor Ley)
May 10, 2024, 3:44pm
4
Thanks, I was hoping for an easier way but if it has to be a BPM then oh well. I have never made a bpm before so thank you for posting the code for it!
klincecum
(Kevin Lincecum)
May 10, 2024, 3:48pm
5
Taylor_L:
easier way
This IS the easiest way. Don’t be messing with those crappy screens.
Post processing BPM on Erp.BO.Customer.GetNewShipTo
ds.ShipTo.FirstOrDefault().TerrSelectFlag = "SYNC"; //Sync to Customer
1 Like
Nickh
(Nick Henkes)
July 3, 2024, 3:45pm
6
Hi @klincecum ! I tried to implement this and got a couple of errors. Specifically:
I feel like we’re close, but something isn’t defined properly. Any idea how to resolve these two errors?
1 Like
klincecum
(Kevin Lincecum)
July 3, 2024, 3:47pm
7
Been a minute, break it down for me in detail.
What you want, what you got, reason, etc.
klincecum
(Kevin Lincecum)
July 3, 2024, 3:50pm
8
Oh I see.
Probably looking for ds.ShipTo
.
The other one in @hkeric.wci code is a ud field he added.
Which leads me to believe you don’t really understand what it’s doing. (sorry )
So anyway, lay it all out as you see it, and we’ll see if we can help.