Solved

How to add Order Number Field in the Create Sales Order Action Dialog

  • 19 December 2021
  • 10 replies
  • 553 views

Hi Team,

I have enabled manual number for Sales Order Number but When I am creating sales order from opportunity it is throwing an error as Manual numbering is activated. I think I have to add Order number field in the dialog box. How can I add Order Number field in the Create Sales Order dialog box ?

 

 

 

icon

Best answer by jinin 21 December 2021, 05:53

View original

10 replies

Userlevel 7
Badge +17

Hi @Shaify In your instance, Manual Numbering sequence is enabled. 

You can enable Auto Numbering sequence, instead adding a SOOrder number in dialog box.

  • Numbering Sequence screen → Select SOORDER (Numbering ID) → Check the Manual Numbering checkbox

 

Userlevel 7
Badge +17

@Shaify If you wanted to work with only Manual Numbering, then it seems it requires a customization that you need to add Sales Order Number on Dialog box and then override the OK button logic to pass this value to the Sales Order Number field.

@Shaify If you wanted to work with only Manual Numbering, then it seems it requires a customization that you need to add Sales Order Number on Dialog box and then override the OK button logic to pass this value to the Sales Order Number field.

Thanks. Can you please provide some steps how can I override OK button method. I am using REST API “entity/Default/18.200.001/Opportunity/CreateOpportunitySalesOrder” to create sales order. Do I need the update the REST API for handling order number field ?

Userlevel 7
Badge +11

Hi @Shaify,

Try the below work around.

  1. Extend the CreateSalesOrderFilter DAC and add the ordernbr field. Also add the field in aspx.
  2. Include the OrderNbr field on the endpoint Opportunity. It wont allow to add the Field directly on the CreateOpportunitySalesOrder action. You can add new action “Create SalesOrder” under Opportunity and add the OrderNbr Parameter.
  3. Extend the CRCreateSalesOrder_SOOrderEntry graph and override the  DoCreateSalesOrder method. 
  4.  

Userlevel 6
Badge +5

You would need to extend the OpportunityMaint graph and override the action to use the provided order id. You would need to extend the CreateSalesOrderFilter DAC to add the order ID field to it(you may also want to add the field to the smart panel but that won’t affect the API). On the endpoint you would need to also add the order id parameter and map it to the new field you created. 

The Rest API maps the parameters to the graph objects(Create Sales Order view in this case) and then just uses the Action handler so you would have to override both. 

Hi @Shaify,

Try the below work around.

  1. Extend the CreateSalesOrderFilter DAC and add the ordernbr field. Also add the field in aspx.
  2. Include the OrderNbr field on the endpoint Opportunity. It wont allow to add the Field directly on the CreateOpportunitySalesOrder action. You can add new action “Create SalesOrder” under Opportunity and add the OrderNbr Parameter.
  3. Extend the CRCreateSalesOrder_SOOrderEntry graph and override the  DoCreateSalesOrder method. 
  4.  

Thanks. Can you please provide some steps how can I extend CreateSalesOrderFilter DAC 

You would need to extend the OpportunityMaint graph and override the action to use the provided order id. You would need to extend the CreateSalesOrderFilter DAC to add the order ID field to it(you may also want to add the field to the smart panel but that won’t affect the API). On the endpoint you would need to also add the order id parameter and map it to the new field you created. 

The Rest API maps the parameters to the graph objects(Create Sales Order view in this case) and then just uses the Action handler so you would have to override both. 

Thanks. Can you please provide some steps how can I extend CreateSalesOrderFilter DAC 

Userlevel 7
Badge +11

Hi @Shaify 

 

  1. Customization Projects → Data Access - > Select the DAC name
  2. Click the  Create New field button and add the new field ordernbr (NonPersistedField)
  3. Publish the package
  4. Customize the Opportunity screen - > Add the field on the popup. 
  5. Then only you can add the field on the endpoint (if required)

 

Attached Sample customization

 

Hi @Shaify 

 

  1. Customization Projects → Data Access - > Select the DAC name
  2. Click the  Create New field button and add the new field ordernbr (NonPersistedField)
  3. Publish the package
  4. Customize the Opportunity screen - > Add the field on the popup. 
  5. Then only you can add the field on the endpoint (if required)

 

Attached Sample customization

 

Thanks. I have added OrderNo field 

 

 

 

 

Just wanted to know how can I access this property inside the Graph extension method

 

Userlevel 7
Badge +11

Hi @Shaify 

Can you please try like below,  
 

Refer the DoCreateSalesOrder code from the CRCreateSalesOrder_SOOrderEntry graph to create the Order.

Use CreateSalesOrderFilter extn DAC to get the OrderNbr field.

public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint>
    {
        public class CRCreateSalesOrderExtn : CRCreateSalesOrderExt
        {
            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;

                DoCreateSalesOrder();

                //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);
            }


            public virtual new void DoCreateSalesOrder()
            {
                CreateSalesOrderFilter filter = this.CreateOrderParams.Current;
                Document masterEntity = this.DocumentView.Current;

                if (filter == null || masterEntity == null)
                    return;


                // Copy the DoCreateSalesOrder code from the CRCreateSalesOrder_SOOrderEntry graph 

            }

        }
 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved