Skip to main content
Solved

Customization: Adding a custom column that is referenceable across forms

  • January 22, 2024
  • 1 reply
  • 69 views

ralph86
Freshman II

I have been reviewing the T-Series Acumatica documentation. I am hoping for a little assistance on where to look for the answer (which course or example best explains the issue) or a simplified concept explanation on this topic.

 

The details line on the opportunity screen (CR304000) does not include a column for target equipment (Target Equipment ID) but it does exist on the Sales Order and Service Order screens. If I wanted to add a custom field to the opportunity screen to add the Target Equipment ID how would I ensure that data within that field flows to the next form in the workflow?

 

Best answer by Samvel Petrosov

The customization will really depend on the specific page. Usually when you create a new entity record like Sales Order in your scenario from another, there is an action for that. Besides adding the custom field to the specific “source” and “destination” DACs you also need to override the action processing the conversion from the  “source” entity into “destination” entity.

 In case of Opportunities page, that action is part of the below GraphExtension. The action itself is defined in the CRCreateSalesOrder_SOOrderEntry class. The action that you need to override is DoCreateSalesOrder.

 

I would say you most likely need to complete T200, T210, T220 and T230 to learn how to do this kind of customizations.

        public class CRCreateSalesOrderExt : CRCreateSalesOrder<OpportunityMaint.Discount, OpportunityMaint, CROpportunity>

        {

            #region Initialization
            public static bool IsActive() => IsExtensionActive();
            protected override DocumentMapping GetDocumentMapping()
            {
                return new DocumentMapping(typeof(CROpportunity))
                {
                    QuoteID = typeof(CROpportunity.quoteNoteID)
                };
            }
            #endregion
            #region Events
            public virtual void _(Events.RowSelected<CROpportunity> e)
            {
                CROpportunity row = e.Row as CROpportunity;
                if (row == null) return;
                CRQuote primaryQt = Base.PrimaryQuoteQuery.SelectSingle();
                bool hasProducts = Base.Products.SelectSingle() != null;
                var products = Base.Products.View.SelectMultiBound(new object[] { row }).RowCast<CROpportunityProducts>();
                bool allProductsHasNoInventoryID = products.Any(_ => _.InventoryID == null) && !products.Any(_ => _.InventoryID != null);
                bool hasQuotes = primaryQt != null;
                CreateSalesOrder.SetEnabled(hasProducts && !allProductsHasNoInventoryID && 
     ((!hasQuotes
          || (primaryQt.Status == CRQuoteStatusAttribute.Approved
 || primaryQt.Status == CRQuoteStatusAttribute.Sent
|| primaryQt.Status == CRQuoteStatusAttribute.Accepted
|| primaryQt.Status == CRQuoteStatusAttribute.Draft
                                )
                            )
                        )
                    && (!hasQuotes || primaryQt.QuoteType == CRQuoteTypeAttribute.Distribution)
                    && e.Row.BAccountID != null);
            }
           #endregion



            #region Overrides
            public override CRQuote GetQuoteForWorkflowProcessing()
            {
                return Base.PrimaryQuoteQuery.SelectSingle();

            }
            #endregion
        }

 

View original
Did this topic help you find an answer to your question?

1 reply

Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+5

The customization will really depend on the specific page. Usually when you create a new entity record like Sales Order in your scenario from another, there is an action for that. Besides adding the custom field to the specific “source” and “destination” DACs you also need to override the action processing the conversion from the  “source” entity into “destination” entity.

 In case of Opportunities page, that action is part of the below GraphExtension. The action itself is defined in the CRCreateSalesOrder_SOOrderEntry class. The action that you need to override is DoCreateSalesOrder.

 

I would say you most likely need to complete T200, T210, T220 and T230 to learn how to do this kind of customizations.

        public class CRCreateSalesOrderExt : CRCreateSalesOrder<OpportunityMaint.Discount, OpportunityMaint, CROpportunity>

        {

            #region Initialization
            public static bool IsActive() => IsExtensionActive();
            protected override DocumentMapping GetDocumentMapping()
            {
                return new DocumentMapping(typeof(CROpportunity))
                {
                    QuoteID = typeof(CROpportunity.quoteNoteID)
                };
            }
            #endregion
            #region Events
            public virtual void _(Events.RowSelected<CROpportunity> e)
            {
                CROpportunity row = e.Row as CROpportunity;
                if (row == null) return;
                CRQuote primaryQt = Base.PrimaryQuoteQuery.SelectSingle();
                bool hasProducts = Base.Products.SelectSingle() != null;
                var products = Base.Products.View.SelectMultiBound(new object[] { row }).RowCast<CROpportunityProducts>();
                bool allProductsHasNoInventoryID = products.Any(_ => _.InventoryID == null) && !products.Any(_ => _.InventoryID != null);
                bool hasQuotes = primaryQt != null;
                CreateSalesOrder.SetEnabled(hasProducts && !allProductsHasNoInventoryID && 
     ((!hasQuotes
          || (primaryQt.Status == CRQuoteStatusAttribute.Approved
 || primaryQt.Status == CRQuoteStatusAttribute.Sent
|| primaryQt.Status == CRQuoteStatusAttribute.Accepted
|| primaryQt.Status == CRQuoteStatusAttribute.Draft
                                )
                            )
                        )
                    && (!hasQuotes || primaryQt.QuoteType == CRQuoteTypeAttribute.Distribution)
                    && e.Row.BAccountID != null);
            }
           #endregion



            #region Overrides
            public override CRQuote GetQuoteForWorkflowProcessing()
            {
                return Base.PrimaryQuoteQuery.SelectSingle();

            }
            #endregion
        }

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings