Solved

How to add "employee selector" on Shipment screen?


Userlevel 5
Badge +2

Hello,

    We are not using the scanner and mobile warehouse mangement service to fulfill shipment.
The users who enter the shipment on screen are not the ones who pick the goods.

     we have a need to record the pickers of the shipment. I say pickers, because it could be 1 picker or 2 pickers at most.  So I am intending to use 2 single selectors with non required setting.

 The pickers might not have the user account in system. But I am thinking I can put them into system as employees and under a “picker group” of “company tree”.
     Can anyone give me some suggestions on the below needs:

1,  How to add the “employee selector” on shipment screen,
2,  The data source of the selector better be restricted to “pickers” only.

3,   The information can be persisted to DB, and can do further reporting later.

4,   The selector better be edited at any shipment status (even completed or invoiced), this is because someone might put wrong picker, so we have the need to correct.

    

      Thank you in advance.

icon

Best answer by Naveen B 6 May 2021, 10:37

Hi @ray20,

Please find the source code to add the Employee Selector and enable it (Even Shipment completed/Invoiced) in the Shipments screen.

 

 public class SOShipmentExt : PXCacheExtension<SOShipment>
{
#region UsrKNVPayFormID
[PXSelector(typeof(Search<EPEmployee.bAccountID>),
typeof(EPEmployee.acctCD),
typeof(EPEmployee.acctName),
SubstituteKey = typeof(EPEmployee.acctCD))]
[PXDBInt()]
[PXUIField(DisplayName = "Employee ID")]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
public int? UsrTestField { get; set; }
public abstract class usrTestField : BqlInt.Field<usrTestField> { }
#endregion
}

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
protected virtual void SOShipment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOShipment row = e.Row as SOShipment;
if (row != null)
{
Base.Document.Cache.AllowUpdate = true;

PXUIFieldAttribute.SetEnabled<SOShipmentExt.usrTestField>(cache, row, true);
}
}
}

 

To enable the field even shipment Completed/Invoiced, along with the code, we need to do some changes in Automation steps for Shipments “Completed” & “Invoiced” Steps. 

Please find the screenshots for reference.

 

An automation Step change for Shipments “Completed” Status

An automation Step change for Shipments “Invoiced” Status

 

Shipments screen with Completed status with Enabled “Employee ID” field

 

Shipments screen with Invoiced status with Enabled “Employee ID” field

View original

10 replies

Userlevel 6
Badge +4

Hi @ray20,

Please find the source code to add the Employee Selector and enable it (Even Shipment completed/Invoiced) in the Shipments screen.

 

 public class SOShipmentExt : PXCacheExtension<SOShipment>
{
#region UsrKNVPayFormID
[PXSelector(typeof(Search<EPEmployee.bAccountID>),
typeof(EPEmployee.acctCD),
typeof(EPEmployee.acctName),
SubstituteKey = typeof(EPEmployee.acctCD))]
[PXDBInt()]
[PXUIField(DisplayName = "Employee ID")]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
public int? UsrTestField { get; set; }
public abstract class usrTestField : BqlInt.Field<usrTestField> { }
#endregion
}

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
protected virtual void SOShipment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOShipment row = e.Row as SOShipment;
if (row != null)
{
Base.Document.Cache.AllowUpdate = true;

PXUIFieldAttribute.SetEnabled<SOShipmentExt.usrTestField>(cache, row, true);
}
}
}

 

To enable the field even shipment Completed/Invoiced, along with the code, we need to do some changes in Automation steps for Shipments “Completed” & “Invoiced” Steps. 

Please find the screenshots for reference.

 

An automation Step change for Shipments “Completed” Status

An automation Step change for Shipments “Invoiced” Status

 

Shipments screen with Completed status with Enabled “Employee ID” field

 

Shipments screen with Invoiced status with Enabled “Employee ID” field

Userlevel 5
Badge +2

@Naveen B 
Great, you are definitely a code master.
I bet I can use your help. However, as my study, I can almostly fulfill my need without writing code.
You know, the less code we write, the less error and maintainence effort we would make.

I can use the “User Define Field” functions to fulfill my need. Although it is not perfectly as your solution, at least right now.
 

 

Note: 

 For simplicity purpose, I can just use “combo” with the picker names listed.
Acumatica also support to define a selector to select the data schema you like (Although I did not test it)

But I have a little enable/disable issue, I will ask in another question.

Userlevel 6
Badge +4

Hi @ray20 Great :) But I don’t think we can manage the User Defined fields from Automation Steps.

If you still need to enable/disable the fields for “Completed/Invoiced” statuses, then you may need to use the customization. :) 

Userlevel 5
Badge +2

@Naveen B  Give me a weekend to do research, if I find a way, I will let you know.
If NOT, I will take your talent codes into use. :grinning:

Userlevel 5
Badge +2

@Naveen B 
Hello, I am using 2020R2. And I started finding almost all automation steps have been deactivated, might by the Acumatica upgrading itself.
Actually, Acumatica is using “state and workflow”  to handle the things “automation steps” did before. 

I can not find the UDF in “automation steps”, but I can find them out in “state and workflow”

But still, unfortunately, for some unknown reason, it is not working.

 

Look below:

any thoughts?
 

Userlevel 5
Badge +2

@Naveen B 
By the way, Captain, I learned from the below article:

  • Grouping by a user-defined field is not supported. If your inquiry includes user-defined fields on the Results Grid tab of the form, these fields are not available for selection on the Grouping tab. For more info, refer to the Creation of Generic Inquiries help article, the Optional Settings section.

I’d like to do calculation based on the picker in grouping. So your solution is the only way to go.

Userlevel 6
Badge +4

Hi, @ray20  Understood. Thanks a lot for sharing this info here. :) 

Userlevel 5
Badge +2

@Naveen B 
Hello, Your code is working, but May I know your Acumatica version?
I still have difficultly to make the fields (add by your code) being enabled through workflow.
In 2020R2, the automation steps of shipment are disabled and can not be activated.

I can only use workflow, but workflow is not working for enable the customized fields.

 

Userlevel 6
Badge +4

Hi, @ray20 I have worked on this requirement in the 20 R1 version.

 

Have you added the below code to enable the fields?
 

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
protected virtual void SOShipment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOShipment row = e.Row as SOShipment;
if (row != null)
{
Base.Document.Cache.AllowUpdate = true;

PXUIFieldAttribute.SetEnabled<SOShipmentExt.usrTestField>(cache, row, true);
}
}
}

 

Userlevel 5
Badge +2

@Naveen B 
Unbelievable, it works.
So I should combine both the codes and the “workflows” to enable the fields?
Super, you saved my day. Thank you so much.

Hi, @ray20 I have worked on this requirement in the 20 R1 version.

 

Have you added the below code to enable the fields?
 

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
protected virtual void SOShipment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOShipment row = e.Row as SOShipment;
if (row != null)
{
Base.Document.Cache.AllowUpdate = true;

PXUIFieldAttribute.SetEnabled<SOShipmentExt.usrTestField>(cache, row, true);
}
}
}

 

 

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 — 2020  Acumatica, Inc. All rights reserved