Change Default Territory Source to be Synchronize to Customer

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.

BPM

Let me look real quick.

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

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!

This IS the easiest way. Don’t be messing with those crappy screens. :rofl:

Post processing BPM on Erp.BO.Customer.GetNewShipTo

ds.ShipTo.FirstOrDefault().TerrSelectFlag = "SYNC"; //Sync to Customer
1 Like

Hi @klincecum ! I tried to implement this and got a couple of errors. Specifically:
image

I feel like we’re close, but something isn’t defined properly. Any idea how to resolve these two errors?

1 Like

Been a minute, break it down for me in detail.

What you want, what you got, reason, etc.

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) :sheep:

So anyway, lay it all out as you see it, and we’ll see if we can help.