public virtual void SetBranchLocationID(PXGraph graph, CROpportunity crOpportunityRow, FSxCROpportunity fsxCROpportunityRow)
        {
            if (crOpportunityRow.BranchID != null)
            {
                UserPreferences userPreferencesRow =
                    PXSelect <UserPreferences,
                              Where <
                                  UserPreferences.userID, Equal <CurrentValue <AccessInfo.userID> > > > .Select(graph);

                if (userPreferencesRow != null &&
                    userPreferencesRow.DefBranchID == crOpportunityRow.BranchID)
                {
                    FSxUserPreferences fsxUserPreferencesRow = PXCache <UserPreferences> .GetExtension <FSxUserPreferences>(userPreferencesRow);

                    if (fsxUserPreferencesRow != null)
                    {
                        fsxCROpportunityRow.BranchLocationID = fsxUserPreferencesRow.DfltBranchLocationID;
                    }
                }
                else
                {
                    fsxCROpportunityRow.BranchLocationID = null;
                }
            }
            else
            {
                fsxCROpportunityRow.BranchLocationID = null;
            }
        }
        public virtual void SetPersistingChecks(PXCache cache,
                                                CROpportunity crOpportunityRow,
                                                FSxCROpportunity fsxCROpportunityRow,
                                                FSSrvOrdType fsSrvOrdTypeRow)
        {
            if (fsxCROpportunityRow.SDEnabled == true)
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);

                if (fsSrvOrdTypeRow == null)
                {
                    fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsxCROpportunityRow.SrvOrdType);
                }

                if (fsSrvOrdTypeRow != null &&
                    fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
                {
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                }
            }
            else
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
            }
        }
        protected virtual void _(Events.FieldUpdated <CROpportunity, FSxCROpportunity.sDEnabled> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunity    crOpportunityRow    = (CROpportunity)e.Row;
            FSxCROpportunity fsxCROpportunityRow = e.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            if (fsxCROpportunityRow.SDEnabled == true)
            {
                FSSetup fsSetupRow = GetFSSetup();

                if (fsSetupRow != null &&
                    fsSetupRow.DfltOpportunitySrvOrdType != null)
                {
                    fsxCROpportunityRow.SrvOrdType = fsSetupRow.DfltOpportunitySrvOrdType;
                }

                SetBranchLocationID(Base, crOpportunityRow, fsxCROpportunityRow);
                Base.Opportunity.SetValueExt <CROpportunity.allowOverrideContactAddress>(crOpportunityRow, true);
            }
            else
            {
                fsxCROpportunityRow.BranchLocationID = null;
            }
        }
        public virtual void createServiceOrder()
        {
            CROpportunity    crOpportunityRow    = Base.Opportunity.Current;
            FSxCROpportunity fsxCROpportunityRow = Base.Opportunity.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            var products = Base.Products.View.SelectMultiBound(new object[] { crOpportunityRow }).RowCast <CROpportunityProducts>();

            if (products.Any(_ => _.InventoryID == null))
            {
                if (Base.OpportunityCurrent.Ask(TX.Messages.ASK_SALES_ORDER_HAS_NON_INVENTORY_LINES, MessageButtons.OKCancel) == WebDialogResult.Cancel)
                {
                    return;
                }
            }

            if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
            {
                fsxCROpportunityRow.SDEnabled        = true;
                fsxCROpportunityRow.BranchLocationID = CreateServiceOrderFilter.Current.BranchLocationID;
                fsxCROpportunityRow.SrvOrdType       = CreateServiceOrderFilter.Current.SrvOrdType;

                PXLongOperation.StartOperation(Base, delegate()
                {
                    CreateServiceOrderDocument(Base, crOpportunityRow, CreateServiceOrderFilter.Current);
                });
            }
        }
        private static bool IsTheRequiredFieldsPresent(PXGraph graph, CROpportunity crOpportunityRow, FSxCROpportunity fsxCROpportunityRow)
        {
            if (crOpportunityRow == null ||
                fsxCROpportunityRow == null ||
                crOpportunityRow.ClassID == null ||
                crOpportunityRow.BranchID == null ||
                crOpportunityRow.Subject == null ||
                crOpportunityRow.ProjectID == null ||
                crOpportunityRow.CloseDate == null ||
                fsxCROpportunityRow.SrvOrdType == null ||
                fsxCROpportunityRow.BranchLocationID == null)
            {
                return(false);
            }

            if (fsxCROpportunityRow.SrvOrdType != null)
            {
                FSSrvOrdType fsSrvOrdTypeRow = GetServiceOrderType(graph, fsxCROpportunityRow.SrvOrdType);

                if (fsSrvOrdTypeRow != null &&
                    fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT &&
                    (crOpportunityRow.BAccountID == null || crOpportunityRow.LocationID == null))
                {
                    return(false);
                }
            }

            return(true);
        }
        protected virtual void _(Events.RowSelected <CROpportunity> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunity crOpportunityRow = (CROpportunity)e.Row;
            PXCache       cache            = e.Cache;

            FSxCROpportunity fsxCROpportunityRow = cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            FSServiceOrder fsServiceOrderRow = CRExtensionHelper.GetRelatedServiceOrder(Base, cache, crOpportunityRow, fsxCROpportunityRow.SOID);
            FSSrvOrdType   fsSrvOrdTypeRow   = null;

            if (fsServiceOrderRow != null)
            {
                fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsServiceOrderRow.SrvOrdType);
            }

            EnableDisableExtensionFields(cache, fsxCROpportunityRow, fsServiceOrderRow);
            EnableDisableActions(cache, crOpportunityRow, fsxCROpportunityRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crOpportunityRow, fsxCROpportunityRow, fsSrvOrdTypeRow);

            HideOrShowFieldsActionsByInventoryFeature();
        }
        protected override void ReverseDocumentUpdate(OpportunityMaint graph, CROpportunity entity)
        {
            var doc = Documents.Current;

            Documents.Cache.SetValue <Document.description>(doc, entity.Subject);
            Documents.Cache.SetValue <Document.qualificationDate>(doc, PXTimeZoneInfo.Now);
            Documents.Cache.SetValue <Document.convertedBy>(doc, PXAccess.GetUserID());
            graph.Caches <TMain>().Update(GetMain(doc));
        }
        protected virtual void _(Events.FieldUpdated <CROpportunity, CROpportunity.branchID> e)
        {
            if (e.Row == null)
            {
                return;
            }
            CROpportunity    crOpportunityRow    = (CROpportunity)e.Row;
            FSxCROpportunity fsxCROpportunityRow = e.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            SetBranchLocationID(Base, crOpportunityRow, fsxCROpportunityRow);
        }
Example #9
0
        public GetAttributeRecords(PXGraph graph, ref int?bAccountID, ref int?inventoryID)
        {
            CROpportunity current1 = graph.Caches <CROpportunity>().Current as CROpportunity;
            PXFieldState  valueExt = graph.Caches <CROpportunity>().GetValueExt((object)current1, "AttributeENDCUSTOME") as PXFieldState;

            bAccountID = PXSelectBase <BAccountR, PXSelect <BAccountR, Where <BAccountR.acctCD, Equal <Required <BAccountR.acctCD> > > > .Config> .Select(graph, valueExt.Value).TopFirst.BAccountID;

            CROpportunityProducts current2 = graph.Caches <CROpportunityProducts>().Current as CROpportunityProducts;

            inventoryID = current2.InventoryID;
        }
        public virtual void EnableDisableCustomFields(PXCache cache,
                                                      CROpportunity crOpportunityRow,
                                                      FSxCROpportunity fsxCROpportunityRow,
                                                      FSServiceOrder fsServiceOrderRow,
                                                      FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.sDEnabled>(cache, null, isSMSetup && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.srvOrdType>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.branchLocationID>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true);
        }
Example #11
0
        protected void CROpportunity_BranchID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated upd)
        {
            upd?.Invoke(cache, e);

            if (e.Row == null)
            {
                return;
            }
            CROpportunity    crOpportunityRow    = (CROpportunity)e.Row;
            FSxCROpportunity fsxCROpportunityRow = cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            SetBranchLocationID(Base, crOpportunityRow, fsxCROpportunityRow);
        }
Example #12
0
        public virtual void createServiceOrder()
        {
            CROpportunity    crOpportunityRow    = Base.Opportunity.Current;
            FSxCROpportunity fsxCROpportunityRow = Base.Opportunity.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
            {
                fsxCROpportunityRow.SDEnabled        = true;
                fsxCROpportunityRow.BranchLocationID = CreateServiceOrderFilter.Current.BranchLocationID;
                fsxCROpportunityRow.SrvOrdType       = CreateServiceOrderFilter.Current.SrvOrdType;

                PXLongOperation.StartOperation(Base, delegate()
                {
                    CreateServiceOrderDocument(Base, crOpportunityRow, CreateServiceOrderFilter.Current);
                });
            }
        }
Example #13
0
        private void EnableDisableActions(
            PXCache cache,
            CROpportunity crOpportunityRow,
            FSxCROpportunity fsxCROpportunityRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup      = GetFSSetup() != null;
            bool insertedStatus = Base.Opportunity.Cache.GetStatus(Base.Opportunity.Current) == PXEntryStatus.Inserted;

            CreateServiceOrder.SetEnabled(isSMSetup && crOpportunityRow != null && insertedStatus == false && fsServiceOrderRow == null);
            ViewServiceOrder.SetEnabled(isSMSetup && crOpportunityRow != null && crOpportunityRow.OpportunityID != null && fsServiceOrderRow != null);
            OpenAppointmentBoard.SetEnabled(fsServiceOrderRow != null);

            Base.createSalesOrder.SetEnabled(fsServiceOrderRow == null);
            Base.createInvoice.SetEnabled(fsServiceOrderRow == null);
        }
 public override void Initialize()
 {
     PXGraph.InstanceCreated.AddHandler <SOOrderEntry>((graph) =>
     {
         graph.RowUpdating.AddHandler <SOOrder>((sender, e) =>
         {
             SOOrder soData = e.NewRow as SOOrder;
             if (soData != null)
             {
                 if (sender.GetStatus(soData) == PXEntryStatus.Inserted)
                 {
                     CROpportunity opData         = Base.Opportunity.Current;
                     CROpportunityPXExt opDataExt = PXCache <CROpportunity> .GetExtension <CROpportunityPXExt>(opData);
                     soData.TermsID = opDataExt.UsrTermsID;
                     soData.ShipVia = opDataExt.UsrShipVia;
                 }
             }
         });
     });
 }
        protected virtual void GetCallerEntity(Guid?refNoteID)
        {
            if (refNoteID != null)
            {
                CRCase crCaseRow = PXSelect <CRCase,
                                             Where <
                                                 CRCase.noteID, Equal <Required <CRCase.noteID> > > >
                                   .Select(Base, refNoteID);

                if (crCaseRow != null)
                {
                    FSxCRCase fsxCRCaseRow = PXCache <CRCase> .GetExtension <FSxCRCase>(crCaseRow);

                    if (fsxCRCaseRow != null && fsxCRCaseRow.SDEnabled == false)
                    {
                        _disableServiceID = false;
                    }

                    _callerEntity = typeof(CRCase);
                }
                else
                {
                    CROpportunity crOpportuniyRow = PXSelect <CROpportunity,
                                                              Where <
                                                                  CROpportunity.noteID, Equal <Required <CROpportunity.noteID> > > >
                                                    .Select(Base, refNoteID);

                    if (crOpportuniyRow != null)
                    {
                        FSxCROpportunity fsxCROpportunityRow = PXCache <CROpportunity> .GetExtension <FSxCROpportunity>(crOpportuniyRow);

                        if (fsxCROpportunityRow != null && fsxCROpportunityRow.SDEnabled == true)
                        {
                            _disableServiceID = false;
                        }

                        _callerEntity = typeof(CROpportunity);
                    }
                }
            }
        }
Example #16
0
        /// <summary> FieldUpdated ENGineering.opprid </summary>
        public void _(Events.FieldUpdated <ENGineering.opprid> e)
        {
            var _graphOpportunity = PXGraph.CreateInstance <OpportunityMaint>();
            var row = e.Row as ENGineering;

            if (e.NewValue != null)
            {
                // Auto get Engineering Field Data
                CROpportunity _oppor = SelectFrom <CROpportunity>
                                       .Where <CROpportunity.opportunityID.IsEqual <P.AsString> >
                                       .View.ReadOnly.SelectSingleBound(this, new object[] { row }, e.NewValue);

                row.OppBAccountID = _oppor.BAccountID;
                row.EndCust       = _oppor.GetExtension <CROpportunityExt>().UsrEndCust;
                row.SalesPerson   = _oppor.GetExtension <CROpportunityExt>().UsrSalesPerson;
                row.SalesRegion   = _oppor?.WorkgroupID.ToString();

                // Auto Get Revenule Line Data
                if (this.RevenueLine.Select().Count == 0)
                {
                    var _oppProduct = SelectFrom <CROpportunityProducts>
                                      .InnerJoin <CROpportunity> .On <CROpportunityProducts.quoteID.IsEqual <CROpportunity.defQuoteID> >
                                      .Where <CROpportunity.opportunityID.IsEqual <P.AsString> >
                                      .View.Select(this, row.Opprid).RowCast <CROpportunityProducts>();

                    foreach (var _prod in _oppProduct)
                    {
                        var _data = this.RevenueLine.Insert((ENGRevenueLine)this.RevenueLine.Cache.CreateInstance());
                        _data.InventoryID = _prod.InventoryID;
                        _data.Descr       = _prod.Descr;
                        _data.Quantity    = _prod.Quantity;
                        _data.Uom         = _prod.UOM;
                        _data.UnitPrice   = _prod.UnitPrice;
                        _data.ExtPrice    = _prod.ExtPrice;
                    }
                }
            }
        }
Example #17
0
        private void EnableDisableCustomFields(
            PXCache cache,
            CROpportunity crOpportunityRow,
            FSxCROpportunity fsxCROpportunityRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.sDEnabled>(cache, null, isSMSetup && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.srvOrdType>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.branchLocationID>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true);

            if (fsSrvOrdTypeRow != null)
            {
                bool isAnInternalSrvOrdType = fsSrvOrdTypeRow.Behavior == ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT;

                PXUIFieldAttribute.SetEnabled <CROpportunity.bAccountID>(cache, null, isAnInternalSrvOrdType || (!isAnInternalSrvOrdType && fsServiceOrderRow == null));
            }
            else
            {
                PXUIFieldAttribute.SetEnabled <CROpportunity.bAccountID>(cache, null, true);
            }
        }
Example #18
0
        protected void CROpportunity_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected sel)
        {
            sel?.Invoke(cache, e);

            if (e.Row == null)
            {
                return;
            }

            CROpportunity    crOpportunityRow    = (CROpportunity)e.Row;
            FSxCROpportunity fsxCROpportunityRow = cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            FSServiceOrder fsServiceOrderRow = CRExtensionHelper.GetRelatedServiceOrder(Base, cache, crOpportunityRow, fsxCROpportunityRow.SOID);
            FSSrvOrdType   fsSrvOrdTypeRow   = null;

            if (fsServiceOrderRow != null)
            {
                fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsServiceOrderRow.SrvOrdType);
            }

            EnableDisableCustomFields(cache, crOpportunityRow, fsxCROpportunityRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            EnableDisableActions(cache, crOpportunityRow, fsxCROpportunityRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crOpportunityRow, fsxCROpportunityRow, fsSrvOrdTypeRow);
        }
Example #19
0
    protected void edContactID_EditRecord(object sender, PX.Web.UI.PXNavigateEventArgs e)
    {
        OpportunityMaint oppmaint = this.ds.DataGraph as OpportunityMaint;

        if (oppmaint != null)
        {
            CROpportunity currentopportunity = this.ds.DataGraph.Views[this.ds.DataGraph.PrimaryView].Cache.Current as CROpportunity;
            if (currentopportunity.ContactID == null && currentopportunity.BAccountID != null)
            {
                {
                    try
                    {
                        oppmaint.addNewContact.Press();
                    }
                    catch (PX.Data.PXRedirectRequiredException e1)
                    {
                        PX.Web.UI.PXBaseDataSource ds = this.ds as PX.Web.UI.PXBaseDataSource;
                        PX.Web.UI.PXBaseDataSource.RedirectHelper helper = new PX.Web.UI.PXBaseDataSource.RedirectHelper(ds);
                        helper.TryRedirect(e1);
                    }
                }
            }
        }
    }
        public static FSServiceOrder GetServiceOrderLinkedToOpportunity(PXGraph graph, CROpportunity crOpportunityRow)
        {
            if (graph == null || crOpportunityRow == null)
            {
                return(null);
            }

            FSServiceOrder fsServiceOrderRow = (FSServiceOrder)PXSelectJoin <FSServiceOrder,
                                                                             InnerJoin <CROpportunity,
                                                                                        On <
                                                                                            CROpportunity.opportunityID, Equal <FSServiceOrder.sourceRefNbr>,
                                                                                            And <FSServiceOrder.sourceType, Equal <FSServiceOrder.sourceType.Opportunity> > > >,
                                                                             Where <
                                                                                 CROpportunity.noteID, Equal <Required <CROpportunity.noteID> > > >
                                               .Select(graph, crOpportunityRow.NoteID);

            return(fsServiceOrderRow);
        }
        public virtual void CreateServiceOrderDocument(OpportunityMaint graphOpportunityMaint, CROpportunity crOpportunityRow, FSCreateServiceOrderFilter fsCreateServiceOrderFilterRow)
        {
            if (graphOpportunityMaint == null ||
                crOpportunityRow == null ||
                fsCreateServiceOrderFilterRow == null)
            {
                return;
            }

            ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(fsCreateServiceOrderFilterRow.SrvOrdType, ID.SourceType_ServiceOrder.OPPORTUNITY);

            CRSetup crSetupRow = GetCRSetup();

            graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);

            CRExtensionHelper.UpdateServiceOrderHeader(graphServiceOrderEntry,
                                                       Base.Opportunity.Cache,
                                                       crOpportunityRow,
                                                       fsCreateServiceOrderFilterRow,
                                                       graphServiceOrderEntry.ServiceOrderRecords.Current,
                                                       Base.Opportunity_Contact.Current,
                                                       Base.Opportunity_Address.Current,
                                                       true);

            SharedFunctions.CopyNotesAndFiles(Base.Opportunity.Cache,
                                              graphServiceOrderEntry.ServiceOrderRecords.Cache,
                                              crOpportunityRow, graphServiceOrderEntry.ServiceOrderRecords.Current,
                                              crSetupRow.CopyNotes,
                                              crSetupRow.CopyFiles);

            foreach (CROpportunityProducts crOpportunityProductsRow in graphOpportunityMaint.Products.Select())
            {
                if (crOpportunityProductsRow.InventoryID != null)
                {
                    InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(graphServiceOrderEntry, crOpportunityProductsRow.InventoryID);

                    if (inventoryItemRow.StkItem == true &&
                        graphServiceOrderEntry.ServiceOrderTypeSelected.Current.PostTo == ID.SrvOrdType_PostTo.ACCOUNTS_RECEIVABLE_MODULE)
                    {
                        throw new PXException(TX.Error.STOCKITEM_NOT_HANDLED_BY_SRVORDTYPE, inventoryItemRow.InventoryCD);
                    }

                    FSxCROpportunityProducts fsxCROpportunityProductsRow = graphOpportunityMaint.Products.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);
                    CRExtensionHelper.InsertFSSODetFromOpportunity(graphServiceOrderEntry, graphOpportunityMaint.Products.Cache, crSetupRow, crOpportunityProductsRow, fsxCROpportunityProductsRow, inventoryItemRow);
                }
            }

            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crOpportunityRow.OpportunityID;

            if (!Base.IsContractBasedAPI)
            {
                throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
            }
        }
        public static void UpdateServiceOrderHeader(
            ServiceOrderEntry graphServiceOrderEntry,
            PXCache cache,
            CROpportunity crOpportunityRow,
            FSCreateServiceOrderOnOpportunityFilter fsCreateServiceOrderOnOpportunityFilterRow,
            FSServiceOrder fsServiceOrderRow,
            CRContact crContactRow,
            CRAddress crAddressRow,
            bool updatingExistingSO)
        {
            bool somethingChanged = false;

            FSSrvOrdType fsSrvOrdTypeRow = GetServiceOrderType(graphServiceOrderEntry, fsServiceOrderRow.SrvOrdType);

            if (fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
            {
                if (fsServiceOrderRow.CustomerID != crOpportunityRow.BAccountID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.customerID>(fsServiceOrderRow, crOpportunityRow.BAccountID);
                    somethingChanged = true;
                }

                if (fsServiceOrderRow.LocationID != crOpportunityRow.LocationID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.locationID>(fsServiceOrderRow, crOpportunityRow.LocationID);
                    somethingChanged = true;
                }
            }

            if (fsServiceOrderRow.BranchID != crOpportunityRow.BranchID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.branchID>(fsServiceOrderRow, crOpportunityRow.BranchID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.BranchLocationID != fsCreateServiceOrderOnOpportunityFilterRow.BranchLocationID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.branchLocationID>(fsServiceOrderRow, fsCreateServiceOrderOnOpportunityFilterRow.BranchLocationID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ContactID != crOpportunityRow.ContactID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.contactID>(fsServiceOrderRow, crOpportunityRow.ContactID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.DocDesc != crOpportunityRow.Subject)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.docDesc>(fsServiceOrderRow, crOpportunityRow.Subject);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ProjectID != crOpportunityRow.ProjectID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.projectID>(fsServiceOrderRow, crOpportunityRow.ProjectID);
                somethingChanged = true;
            }

            if (crOpportunityRow.OwnerID != null)
            {
                if (crOpportunityRow.OwnerID != (Guid?)cache.GetValueOriginal <CROpportunity.ownerID>(crOpportunityRow))
                {
                    int?salesPersonID = GetSalesPersonID(graphServiceOrderEntry, crOpportunityRow.OwnerID);

                    if (salesPersonID != null)
                    {
                        graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.salesPersonID>(fsServiceOrderRow, salesPersonID);
                        somethingChanged = true;
                    }
                }
            }

            if (fsServiceOrderRow.OrderDate != crOpportunityRow.CloseDate)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.orderDate>(fsServiceOrderRow, crOpportunityRow.CloseDate);
                somethingChanged = true;
            }

            ApplyChangesfromContactInfo(graphServiceOrderEntry, crContactRow, fsServiceOrderRow, ref somethingChanged);
            ApplyChangesfromAddressInfo(graphServiceOrderEntry, crAddressRow, fsServiceOrderRow, ref somethingChanged);

            if (fsServiceOrderRow.TaxZoneID != crOpportunityRow.TaxZoneID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.taxZoneID>(fsServiceOrderRow, crOpportunityRow.TaxZoneID);
                somethingChanged = true;
            }

            if (somethingChanged && updatingExistingSO)
            {
                graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
            }
        }