Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.Objects.CR;
using PX.Objects.FS;
namespace MyCompany.DefaultProjects
{
public class ServiceOrderEntryExtDefaultProject : PXGraphExtension<ServiceOrderEntry>
{
public static bool IsActive() => true;
#region Actions
#endregion
#region Events
protected virtual void _(Events.FieldUpdated<FSServiceOrder, FSServiceOrder.customerID> eventHandler)
{
FSServiceOrder row = eventHandler.Row;
if (row is null || row.CustomerID is null) return;
Location serviceOrderLocation = SelectFrom<Location>
.Where<Location.bAccountID.IsEqual<@P.AsInt>
.And<Location.locationID.IsEqual<@P.AsInt>>>
.View.Select(Base, row.CustomerID, row.LocationID);
if (serviceOrderLocation is not null && serviceOrderLocation.CDefProjectID is not null)
eventHandler.Cache.SetValueExt<FSServiceOrder.projectID>(row, serviceOrderLocation.CDefProjectID);
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment