Scan Mode Redirects: General Information
You can use the ScanRedirect component to give a user the ability to change the scan mode. A user will be able to change the scan mode in any scan state either by clicking a button associated with this redirect in the UI (only in the mobile app), or by scanning a barcode associated with it (only in the web application).
Learning Objectives
In this chapter, you will learn how to define the set of mode redirects.
Applicable Scenarios
You perform this business process in the following cases:
- You have created a scan mode on a custom form and need to implement the redirects for this mode.
- You have added a new scan mode on an existing barcode-driven form and need to implement the redirects for this mode.
The ScanRedirect Component
ScanRedirect<TScanBasis> is a component that contains logic related to a
transition from one mode to another. It works similarly to the
ScanCommand<TScanBasis>
class. It produces a PXAction
member and can be invoked by scanning a barcode.
Default Set of Mode Redirects
Because all predefined barcode-driven forms are known when the form is designed, the system provides a global list of redirects, which contains redirects to any barcode-driven form. You can access this list through the AllWMSRedirects.CreateFor<TScanBasis>() method. Therefore, you can implement redirection of a user from any predefined barcode-driven form to any other barcode-driven form.
If you need to add a redirect to a custom mode, you cannot extend this list itself, but you can create a generic extension that adds a redirect (to a new form) to all other forms.
Implementation of a Redirect Object
You create particular instances of the ScanRedirect<TScanBasis> class in
the ScanMode<TScanBasis>.CreateRedirects()
method. Typically, you use
AllWMSRedirects.CreateFor<TScanBasis>() in this method to define the
full set of redirects for a mode. However, the list of available redirects could still be
listed manually if you create the proper redirect object.
- Code: The code that is used to perform the redirect. The
@
character is added to the beginning of all redirect codes so that the system can distinguish them from the codes intended for processing by input state processors. - DisplayName: The display name of the button for the PXAction instance that is created for this redirect.
- IsPossible: The Boolean value that specifies (if set to
true
) that it is possible to scan the redirect code and the redirect button is displayed in the UI. Redirects that are not possible are invisible in the UI.
You should keep in mind that any redirect object refers to two barcode-driven forms: the source and the target. Sometimes the source and the target can be the same form.