Solved

How to check the Serial number on the Case screen when the customer brings the device for warranty?

  • 5 October 2023
  • 11 replies
  • 323 views

Userlevel 3
Badge

Dear Team,

 

Please help us with the following situation.

We will warranty equipment products for customers with our products sold. The product is only warranted if the customer's product Serial number matches the Serial number of the Acumatica system that stores Serial data when sold.

We save the Serial number when products are Receipted/Issued through the field "Lot/Serial Nbr." on the Acumatica system.

When customers bring the device in for warranty service. We need to first check the Serial number on the "Case" screen. We've created new fields on the "Case" screen as below to do this.

 

 

The results we expect are depicted as shown below:

 


1/. On the Case screen. When entering the Serial number in the UsrSerialNbr(Serial Check) field => press Enter. If Serial number is found in PX.Objects.SO.SOShipLine => The fields (InventoryID, Inventory Description, ShipDate, OrderNbr) will display the corresponding data taken from DAC SOShipLine.
2/. Conversely, If the Serial number is not found in PX.Objects.SO.SOShipLine => Show the message "Not found"

 

With the assumption that a Serial number in PX.Objects.SO.SOShipLine is unique to a device.

 

Please help us how to do this.

 

Note: Acumatica Version: 2020 R1

 

Best Regards,

NNT

 

 

icon

Best answer by Vignesh Ponnusamy 5 October 2023, 15:38

View original

11 replies

Userlevel 7
Badge +4

Hi @nhatnghetinh,

Following is a place you start with,

You can use either FieldSelecting or FieldVerifying events of the custom field in which you query(using BQL) the fields from the database verify/display them or set error if no matching records found. 

Please feel free to post any specific question or code you need assistance with. Good Luck.! 

Userlevel 3
Badge

Hi @Vignesh Ponnusamy,

 

I did as you instructed but got the error below.
Please help me fix the error

==========================================================

Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\CRCaseMaint.cs(59): error CS1061: 'CRCase' does not contain a definition for 'UsrSerialNbr' and no accessible extension method 'UsrSerialNbr' accepting a first argument of type 'CRCase' could be found (are you missing a using directive or an assembly reference?)

 

==========================================================

using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.Objects.CR.MassProcess;
using PX.Objects.CS;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using PX.Common;
using PX.Data;
using System.Collections;
using PX.Data.EP;
using PX.Objects.AR;
using PX.Objects.CT;
using PX.Objects.CR.Workflows;
using PX.Objects.GL;
using PX.Objects.EP;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.SM;
using PX.TM;
using PX.Objects;
using PX.Objects.CR;
using PX.Objects.SO;

namespace PX.Objects.CR
{
  public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
  {
    
  
       #region UsrSerialNb
       [PXDBString(200, IsUnicode = true)]
       [PXUIField(DisplayName="Serial Check")]
       public virtual string UsrSerialNbr { get; set; }
       public abstract class usrSerialNbr : PX.Data.BQL.BqlString.Field<usrSerialNbr> { }
       #endregion
         

       #region UsrInventoryID
       [PXDBString(30, IsUnicode = true)]
       [PXUIField(DisplayName="InventoryID")]
       public virtual string UsrInventoryID { get; set; }
       public abstract class usrInventoryID : PX.Data.BQL.BqlString.Field<usrInventoryID> { }
       #endregion
         
  
    #region Event Handlers
    protected void CRCase_UsrInventoryID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
    {
      var row = (CRCase)e.Row;
            if (row == null)
            {
                return;
            }
            SOShipLine sOShipLine = PXSelect<SOShipLine,
                Where<SOShipLine.lotSerialNbr, Equal<Required<SOShipLine.lotSerialNbr>>>>.Select(Base, row.UsrSerialNbr);
            if (sOShipLine == null) { return; }
            e.ReturnValue = sOShipLine.InventoryID;    
    }
    #endregion
      
  }
}

 

 

=============================================================

 

 

 

Userlevel 4
Badge +1

As a solution you can add the PXSelector attribute on the UsrSerialNbr(Serial Check)  field based on the SOShipLine and SOShipLineSplit DACs join. 

If serial is not found the PXSelector attribute will throw standard error message not found(no more code needed).

if serial is found you can add PXDefault attribute each on the next additional field to populate the corresponding values from SOShipLine and SOShipLineSplit DACs. For this you can write code under the FieldUpdated event handler created for the UsrSerialNbr(Serial Check) field in the CRCaseMaint graph extension.

Userlevel 7
Badge +4

@nhatnghetinh, You should be using GetExtension of the DAC to access to custom field.

You can refer to the example in the following disucssions,

  •  

  •  

If the issue still persists, can you please share the customization project for me to take a look?

 

 

Userlevel 3
Badge

Hi @Vignesh Ponnusamy

Glad to receive your response. I would like to share you the customization project.

Looking forward to your support !

 

Best Regards,

NNT

 

 

Userlevel 7
Badge +4

@nhatnghetinh,

You can try like below using PXCache.GetExtension(comments about the code),

        protected void CRCase_UsrInventoryID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
{

if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (CRCase)e.Row;
if (row == null)
{
return;
}

CRCaseExt rowExt = PXCache<CRCase>.GetExtension<CRCaseExt>(row); //to get the DAC extension of CRCase

SOShipLine sOShipLine = PXSelect<SOShipLine,
Where<SOShipLine.lotSerialNbr, Equal<Required<SOShipLine.lotSerialNbr>>>>.Select(Base, rowExt.UsrSerialNbr); //use the extension object, then the field name in the query
if (sOShipLine == null) { return; }

e.ReturnValue = sOShipLine.InventoryID;
}

Hope that helps.! Good Luck,

Userlevel 7
Badge +9

Hi @nhatnghetinh Please find the below steps without a customization. This is just to avoid extensive customization and help clients who can manage without any customizations.

  1. Create a GI to show the SOShiplines fields - Customer ID,OrderNbr,ShipmentNbr,ShiDate ShipmentDate, InventoryID Serial # serial numbers etc.,
    I see that you already have the generic inquiry created with name DACSOShipline
  2. Create a Side Panel on the cases screen. The Side Panel should be configured to accept the Parameters - Serial #, OrderNbr to show the serial details of the shipments belonging to the Sales Order.

Thanks

 

 

Userlevel 3
Badge

Hi @Vignesh Ponnusamy,

Thank you for your feedback. The previous error has been fixed.
So I have 2 problems and would like to ask you as follows:

Problem 1: 

On the Case screen. When entering Serial Number => Click Enter => Nothing happens.

 

But if the SAVE button is pressed, the data is updated for the custom fields.


Please help me => When entering Serial Check => Click Enter => the data will be updated for the custom fields (no need to press SAVE)

 

Problem 2: 

Because SOShipLine does not have fields like Customer Code and Customer Name. So I have to create a new DAC to get these fields.
New DAC (ViewSerial) is created by "SQL scrip" & "Create New DAC" on Customization Project.

 

 

 

  
 //////////////////////////////////////////////////////////////////// 

protected void CRCase_CustomerID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
    {
      if(InvokeBaseHandler != null)
        InvokeBaseHandler(cache, e);
       var row = (CRCase)e.Row;
            if (row == null)
            {
                return;
            }


            CRCaseExt rowExt = PXCache<CRCase>.GetExtension<CRCaseExt>(row); //to get the DAC extension of CRCase

            ViewSerial viewSerial = PXSelect<ViewSerial,
                Where<ViewSerial.lotSerialNbr, Equal<Required<ViewSerial.lotSerialNbr>>>>.Select(Base, rowExt.UsrSerialNbr); //use the extension object, then the field name in the query
            if (viewSerial == null) { return; }

            e.ReturnValue = viewSerial.AcctCD;
      
    }
 

//////////////////////////////////////////////////////////////

 

=======================

Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\CRCaseMaint.cs(47): error CS1061: 'ViewSerial' does not contain a definition for 'AcctCD' and no accessible extension method 'AcctCD' accepting a first argument of type 'ViewSerial' could be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\CRCaseMaint.cs(47): error CS1061: 'ViewSerial' does not contain a definition for 'AcctCD' and no accessible extension method 'AcctCD' accepting a first argument of type 'ViewSerial' could be found (are you missing a using directive or an assembly reference?)

======================

 

 

But I got the error above caused by CRCase_CustomerID_FieldSelecting

I would like to share you the customization project.

Looking forward to hearing from you.

 

Best Regards,

NNT

 

Userlevel 7
Badge +4

Hi @nhatnghetinh,

For the 1st issue, you can use CRCase_UsrSerialNbr_FieldSelecting event and set all the field values in there. If the UI doesn’t display the values even then you can try using Base.Case.View.RequestRefresh() at end of the method which should do the UI refresh updating the values in the UI.

 

For the 2nd issue, I am not sure, everything seems good to me. I will continue checking it and will keep you posted. Thanks, 

Userlevel 3
Badge

Hi  Vignesh Ponnusamy,

I have fixed the issues. For the 2nd issue needs to fix: e.ReturnValue = viewSerial.Acctcd;

Thank you for your support !

 

Best Regards,

NNT

Userlevel 7
Badge +4

Hi @nhatnghetinh,

Great.! Thanks for the update.

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