FXL Item Picker Setup
Introduction
FX Item Picker enables FieldFX Back Office users to find and select items from one sObject and add them to another sObject. You can also use the FX Item Picker in the Lightning version.
-
Add items to a ticket while looking at the quote, filtered by the correct price book.
-
Add items to a ticket from a list of items included on the quote.
-
Add items to a price book from a selection of catalog items.
The FX Item Picker is generic and intended to be highly customizable.
Optionally, you can configure custom labels for the FX Item Picker Lightning Component.
To use the FieldFX Lightning package starting with version 1.225, you must use the FieldFX Managed Package version 1.529 or higher. To find the version numbers you have installed, see Check Version Number for FieldFX Managed Package and FieldFX Lightning Managed Package. |
Prerequisites
Complete the Salesforce Lightning AppBuilder training before setting up and configuring the FX Item Picker for the first time. |
To set up the FX Item Picker, you need:
Needed Permissions | Needed Licenses | Complete These Tasks Prior to First Time Setup |
---|---|---|
|
|
Considerations
The FX Item Picker depends on the related object’s Search layout. if the record is in a read-only Workflow Status, Items can’t be added to the associated item grid.
Do not add the FX Item Picker inside of an Accordion Lightning Component. Doing so leads to undesirable results and slow performance. |
Adding a Field to an Existing FX Item Picker
If an Admin adds an additional field to the search layout used by an existing FX Item Picker, users must manually activate that field in the FX Item Picker before it displays for the user.
-
Access the affected FX Item Picker.
-
Select to the right of the FX Item Picker’s Search field.
-
Click to select the new field’s blank checkbox.
The field displays in the FX Item Picker.
Step-by-Step Guides
In setting up the FX Item Picker you can use custom code snippets for APEX and JavaScript to capture and publish a lightning event. There are also steps on the advanced usage for the filter settings.
The Item Picker doesn’t work for Text Area, Text Area (Long), or Text Area (Rich Text) field types. These are automatically filtered out by the picker. The Picker Object specified must have a Search Layout defined that includes fields of other types available for the FX Item Picker to work. |
-
Switch to the Lightning Experience.
-
Access the page that you want to use the FX Item Picker.
-
Select , then click Edit Page.
-
Type
FX Item Picker
in the Search components.. box. -
Drag the FX Item Picker from the Custom - Managed list to the place on the page where you want the picker to appear.
-
Make sure the Item Picker is the selected component on the page.
-
Define the settings for the component using the options on the right side of the screen.
Table 1. Item Picker Configuration Options Settings Description Picker Heading
Enter the heading of the picker. See Customize the Picker Heading and Title section.
Picker Title
Enter the title for the picker. See Customize the Picker Heading and Title section.
Compact checkbox
Select to use smaller grid rows and columns.
Picker Object
(Required)The sObject from which you need to select items.
If the object is a price book in a price book hierarchy with extended pricing enabled for the job, the results grid displays additional results from parent price book(s) in the hierarchy.
The
Enable_Extended_Price__c
field must exist on the Job and Quote objects and must be set totrue
for the specific Job or Quote for this feature.See the price book hierarchy setup instructions for details.
The specified Object must have a Search Layout that includes fields other than Text Area, Text Area (Long), or Text Area (Rich) type fields.
Those fields can be present on the search layout as well, but there must be other types of data on the search layout for the object for the FX Item Picker to function.
Picker Lookup Field
The field on the object you want use to filter items in the resulting grid.
Picker Lookup Value
The path to the field on the current page you want to use as the value for the Picker Lookup Field used for the filter.
Picker Filter
A SOQL statement to control valid entries.
For example, a SOQL statement to filter out archived items.
Action Button Label
Text to display on a button a user can click to act on selected items.
For example,
Create Ticket Items
as the button text to add selected items to a ticket.Target Object
The sObject where the entries should be added.
Target Object Parent Lookup Field
The field on the current page that names the parent object for the selected items being created.
For example, for the Target Object
FX5__Ticket_Item__c
,FX5__Ticket__c
is the parent field, because every ticket item must be on a ticket.Target Object Item Field
The field on the target object to create the records in.
Show the '# of Items Columns' Column
checkboxSelect this checkbox to show a new column of the number of items.
Field For '# of Items' Column
Enter the text for the column title. You can use an expression to define its custom label. The correct format is
$Label.customLabelName
.Always fire lightning event
Use this to automatically kick off a lightning event.
If it’s unchecked and after an item is added, the FX Item Picker sends a refresh event that other Lightning components can listen out for, then refresh if they need to.
If it’s checked, other FieldFX components can be designed to listen for the event and then process the event as they are designed for.
UID of Item Cart
(optional)UID of the FXL Item Cart to update with selections from this FX Item Picker.
Parent Field (For Bundles)
(optional)field on the sObject that items are bundled by.
For example, for Price Book Items, the field is the
Parent_Price_Book_Item__c
field.When parent and child items exist in the picker:
-
You can collapse the group of items to show only the parent item.
-
Child items cannot be selected.
-
The parent and all children are selected together from the picker and added to the Target Object.
Expand Children by Default checkbox
(optional)Select to display parent and child items when the FXL Item Cart loads; otherwise, only parent items display and users must expand the parent item(s) to see child items
Users retain the ability to expand or collapse the child items with either option .. Max number of items that can be inserted at once: number of items users can select to add to the FXL Data Grid at the same time. The default value when blank is 6. The maximum number that can be selected at once is 100. If users select more items than the allowed value, they are not able to add the items to the FXL Data Grid. The button is grayed out.
When the user hovers over the button, a message displays informing the user of the maximum number of selected items.
This option does not apply if the selected items go to an FX Item Cart. Max Number of items that can be inserted at once
Enter the maximum number of items that are shown in the grid at one time.
Even though setting a maximum number to 500, a high number like that can impact performance and cause a degradation in grid display. Start with 100 at first. If there is a degradation, have your admin lower the number. Column for setting insert sequence order (leave blank to deactivate)
This column sets the insert sequence order. If you set this field, it will increment on the target object by one per insert. You can use an expression to define its custom label. The correct format is
(!$Label.customLabelName)
.See Customize Selected Items Sequence for more information.
Target’s Parent Field
(For bundles, when setting sequence)This field is used to bundle child items on the target object. You can use and expression to define a custom label. The correct format is
(!$Label.customLabelName)
.Set Component Visibility > Filters
Click to add a filter.
See Advanced Filter Settings Use for more information.
-
-
Click Save.
See specific setup examples below the image. Figure 1. Default FX Item Picker settings for selecting Quote Items to add to a Ticket.
Lightning Event Code Snippets
If you want to capture and publish a lightning event, use the following code snippets.
APEX Code Snippet (Capturing a Lightning Event)
The below example highlights an apex class that contains a function called forward
. The function accepts a JSON string object, deserializes it, and returns the object. In the return
portion of the code, you can replace the snippet of code with whatever you need to do with the event, including forwarding it to another API, etc.
public with sharing class fxlwc_controller_event {
@AuraEnabled
public static String forward(String event){
try {
Object eventData = JSON.deserializeUntyped(event);
return event;
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
}
}
For more information, see Salesforce Developer Documentation: Communicate with Events.
JavaScript Code Snippet (Publishing a Lightning Event)
The below snippet of code is the JavaScript side of this lightning web component. The messageService, FXL_MESSAGE, and the invokeForwardEvent
function are imported.
The LWC subscribes to the message lightning events channel using the subscribeMC()
function. This function simply runs a subscribe method and passes in a brand-new message context, a channel to listen to FXL_MESSAGE
, a handler, and an object scope. Whenever this component receives an event, it will convert the JSON string to an the event, and fire it to the apex function forward
by using the invokeForwardEvent
function that was imported. In doing so, the apex code, shown above, will capture the event, deserialize it, and the implementor is free to do what they will with the event.
import { LightningElement, track } from "lwc";
import {
subscribe,
APPLICATION_SCOPE,
createMessageContext,
} from "lightning/messageService";
import FXL_MESSAGE from "@salesforce/messageChannel/FXL_MESSAGE__c";
import invokeForwardEvent from "@salesforce/apex/fxlwc_controller_event.forward";
export default class Fxlwc_event_viewer extends LightningElement {
@track subscription = null;
@track receivedMessage = "";
constructor() {
super();
this.subscribeMC();
}
subscribeMC() {
if (this.subscription) {
return;
}
this.subscription = subscribe(
createMessageContext(),
FXL_MESSAGE,
(message) => {
this.handleReceivedMessage(message);
},
{ scope: APPLICATION_SCOPE }
);
}
handleReceivedMessage(message) {
this.receivedMessage = message
? JSON.stringify(message, null, "\t")
: "no message payload";
invokeForwardEvent({event: JSON.stringify(message)}).catch(err => {
console.error(err);
});
}
get subscribeStatus() {
return this.subscription != null ? "True" : "False";
}
}
To publish events in lightning web components, execute this.dispatchEvent(new CustomEvent('previous'));
if the JavaScript class extends the LightningComponent class. See Salesforce Developer Documentation: Create and Dispatch Events for more information regarding dispatching lightning events.
In the example code above, the event captured was fired by an older EventService that was written, however, it works the same way.
Customize the Picker Heading and Title
You can customize the Picker Heading and Picker Title fields for the FX Item Picker on any records page where it’s being used.
If you leave these fields blank,
-
The Picker Heading defaults to
FXL Data Grid
-
The Picker Title defaults to the item’s object label.
These properties also support using an expression to define its custom label. The correct format is (!$Label.customLabelName)
.
Advanced Filter Settings Use
You can use these two settings to take advantage of advanced filter settings.
Setting | Example | Description |
---|---|---|
$source |
Target__Segment__c = '$source.Segment__c' |
Allows the user to incorporate into filters the record detail (if applicable) and its specific fields. For example, Picker results are filtered to Segment__c on the source record. |
$user |
CreatedBy.User.Id = '$user.id' |
Allows incorporation into filters the logged in User and its specific fields. For example. Picker results are filtered to only those items created by the logged in User. |
There is no autocompletion for the properties of the objects. You should follow SOQL rules for the where clause. |
Customize Selected Items Sequence
This functionality is intended specifically to address a scenario where the FX Item Picker is used to add Ticket Items to an Invoice. |
With the FX Item Picker a user can define the sequence number used when adding the selected items to the FXL Data Grid. After set up, the user can define the order in which selected items should be added to the FXL Data Grid.
Items are added to the Selected Items tab of the FX Item Picker in the order in which the user selects them. The user can use the arrows in the Order column of the Selected Items tab to reorder the selected items before adding them to the FXL Data Grid.
Child items are added immediately after their parent item, but can be reordered within the limits of the parent item’s sequence.
Sequence numbers are controlled by two fields in the FX Item Picker component’s settings:
Column for setting insert sequence order |
A number field on the target object to use for sequencing items Leaving this field blank disables the sequence numbering by selection order.
|
||
Target’s Parent Field |
Field on the target object that defines the parent for child items For example, for the FX Item Picker used to add Invoice Items,
|
Sequence Number Considerations
The assignment of sequence numbers by selection order applies only to FieldFX Back Office. Sequence number assignments from items added in FieldFX Mobile continue to behave as they always have.
If the organization also has FX CPQ and utilizes the Rule Engine, the sequence numbers for items added by the Rule Engine are determined by the Rule Engine and do not follow the settings from the FX Item Picker.
Examples
These examples show the values to use when selecting items from tickets, quotes, price books, invoices, and FX EAM Purchase Orders.
For each example, add the FX Item Picker component to the page for the object you are working with. |
Object Type | Example |
---|---|
Ticket |
|
Quote |
|
Price Book |
|
Invoice |
|
EAM Purchase Order |
For a Ticket
Select Items To Add from a Price Book
Component Option | Value |
---|---|
Picker Object |
|
Picker Lookup Field |
|
Picker Lookup Value |
|
Picker Filter |
|
Action Button Label |
|
Target Object |
|
Target Object Parent Lookup Field |
|
Target Object Item Field |
|
If Price Book Hierarchy is enabled, items from parent price books also display. |
For a Quote, Select Items to Add from a Price Book
Component Option | Value |
---|---|
Picker Object |
|
Picker Lookup Field |
|
Picker Lookup Value |
|
Picker Filter |
|
Action Button Label |
|
Target Object |
|
Target Object Parent Lookup Field |
|
Target Object Item Field |
|
For a Price Book, Select Items to Add from Catalog Items
Component Option | Value |
---|---|
Picker Object |
|
Picker Lookup Field |
|
Picker Lookup Value |
|
Picker Filter |
|
Action Button Label |
|
Target Object |
|
Target Object Parent Lookup Field |
|
Target Object Item Field |
|
For an Invoice, Select Items to Add from Ticket Items
Caution: The generic FX Item Picker controls will likely not produce desired results for invoicing without additional configurations. |
Component Option | Value |
---|---|
Picker Object |
|
Picker Lookup Field |
|
Picker Lookup Value |
|
Picker Filter |
|
Action Button Label |
|
Target Object |
|
Target Object Parent Lookup Field |
|
Target Object Item Field |
|
For an FX EAM Purchase Order, Select Stock Items to Add from a Warehouse
Component Option | Value |
---|---|
Picker Object |
|
Picker Lookup Field |
|
Picker Lookup Value |
|
Action Button Label |
|
Target Object |
|
Target Object Parent Lookup Field |
|
Target Object Item Field |
|