Thursday, 24 August 2023

Salesforce FSL Inventory Management

Field Service Inventory Management Data Model 

Use Field Service’s inventory objects to track the storage, request, consumption, return, and retirement of items in your inventory. 

Field Service Inventory Management consists of various custom objects like location, product Item, Product Transaction, Product Consumed, and Product Required also includes standard objects like the product, Price Book, Work Order, and Work Order Line Item.

Product 
A product represents your company selling and providing services to customers.
  • Create Product for Field Service
    • From the Product tab, click New
    • Enter a product name. 
    • Activate the product.
    • Add the description.
    • Click Save.

Price Book
A price book is a list of products and their associated prices. Each product and its price is called a price book entry. The price book will provide a list of the products and the different prices for the products.
  • Create Price book for Field Service
    • From the Price book tab, click New
    • Enter a price book name. 
    • Activate the price book.
    • Add the description.
    • Click Save.
  • Add product to price book.
    • Go to the Price Book-related tab, From the Price Book entries tab, click Add Products.
    • Click the selection box for this product and add List Price.

Work Order 
A work order tracks work to be performed for a customer. 
  • Create Work Order for Field Service 
    • From the Work Order tab, click New
    • Optionally, select a work type.   
    • Enter the address for the work order. The work order’s service appointments and line items inherit their address, though the address online items can be updated. 
    • Optionally, to link each work order line item to a price book entry (product), select a price book. 
    • Complete the remaining fields as needed. 
    • Click Save. 

Work Order Line Item
Represents a subtask on a work order in field service. 
  • Create Work Order Line Item for Field Service 
    • Go to the Work Order tab, From the Work Order Line Item tab, click New.
    • Automated add Work Order Name. 
    • Select a work type.   
    • Optionally, to link each work order line item to a price book entry (product), select a price book and product. 
    • Add quantity and Unit Price of product.
    • Complete the remaining fields as needed. 
    • Click Save.  

Location 
Locations are places where inventory is stored for a field service operation. Create locations so you can track the items stored there and restock items when necessary. 
The location has many types like Warehouse (default), Site, Van, and Plant. 
  • Create Inventory Locations for Field Service 
    • From the Locations tab, click New
    • Enter a location name. 
    • Select a location type (Warehouse, Site, Van, Plant), the default location type is a warehouse. 
    • If inventory is stored at the location, select Inventory Location. This allows you to associate the location with items in your inventory, known as product items. 
    • If the location can be moved, like a van, select Mobile Location.
    • Click Save                

Product Item 
Product items represent your inventory. Product items represent the stock of a particular product at a particular location.  Each product item is linked to a storage location, such as a van or warehouse, and to a specific product, indicating the item being stored. Create product items so you can track inventory usage and restock when necessary. 
  • Create Product items for Field Service 
    • Go to Location related tab, From the Product Items tab, click New
    • Use the lookup field to select a product. 
    • Use the lookup field to select the location where the product item is stored. Only locations that have the Inventory Location option selected can be associated with product items. 
    • Enter the Quantity on Hand, which is the amount at this location. 
    • If needed, add a unit of measure. These values are inherited from the Quantity Unit of Measure field on products. 
    • Click Save.                
 

Product Required 
Represents a product that is needed to complete a work order or work order line item in field service. If a particular product is needed to complete a field service job, add products required to ensure that the assigned service resources arrive prepared. Products required can be child records of work orders, work order line items, and work types. Work order and work order line items inherit their work type’s products required.  
   

Product Consumed 
Represents an item from your inventory that was used to complete a work order or work order line item in field service. When a product is consumed during the completion of a work order, track its consumption by creating a product consumed record. You can add products consumed to work orders or work order line items. Track product consumption at the line-item level if you want to know which products were used for each line item’s tasks.   


Product Item Transaction 
Represents an action taken on a product item in field service. Product item transactions are auto-generated records that help you track when a product item is replenished, consumed, or adjusted.

  • In the above Transaction, we consumed 1 quantity of PI-0040 Product Item. The total quantity of PI-0040 Product Items is 100. 
 
These objects are used to track the movement of items between locations and into and out of your inventory


Product Request 
Product requests represent a part or orders for products, which you might create when stock is running low.
  • Create Product Requests for Field Service 
    • From the Product Requests tab or the Product Requests related list on a work order or work order line item, click New
    • If the request is being made for a particular job, select the related work order or work order line item. 
    • Enter the destination location, which is where the parts are needed. 
    • Enter the address where the parts should be shipped; for example, the mailing address of the warehouse that is requesting them. 
    • Enter the Need by Date till then we need the order. 
    • If the parts are being transferred from another location such as a warehouse, enter the source location. 
    • Assign the product request a status (Draft, Submitted, Received) 
    • Click Save.                 

Product Request Line Item 
Product request line items are subdivisions of a product request. Each line item is associated with a specific product being requested. They have the following fields. 
  • Create Product Request Line Item for Field Service 
    • From the Product Request Line Items related list, click New
    • Select the product that is needed. 
    •  Enter a quantity and unit of measure. These values are inherited from the Quantity Unit of Measure field on products. 
    • Fill in the rest of the fields as needed. The parent product request’s shipping and related record information is auto-populated on its line items. 
    • Click Save

Shipment 
Shipments represent the shipment of product items between locations. Shipments contain information about the products on board, the shipping carrier, and the expected delivery date. 
  • Create Shipment for Field Service 
    • From the Shipments tab, click New. 
    • Add the shipment’s origin and destination. If applicable, select the field service locations where the shipment departs or arrives. 
    • Add details about the shipping provider and delivery date. 
    • Click Save. 

Product Transfer 
To fulfill a product request, create a product transfer. Product transfers track the movement of inventory from one field service location to another. The inventory numbers at your storage locations update automatically to reflect transfers. 
  • Create Product Transfer for Field Service 
    • From the Product Transfers tab or the Product Transfers related list on a product request, product request line item, product item, location, or shipment, click New
    • Enter a source product item or product. 
    • If you're transferring the parts from a location within your inventory such as a warehouse, enter a source product item. The source product item shows where the parts are being transferred from and updates the quantity at the source location. For example, to transfer five hammers from Warehouse A to Warehouse B, select the product item record that tracks the hammers stored at Warehouse A. 
    • If you're transferring products from outside your inventory, such as from a manufacturer, enter a product name. 
    • Enter the quantity to transfer and the Quantity Unit of Measure. Quantity Unit of Measure picklist values are inherited from the Quantity Unit of Measure field on products. 
    • If the product request line item is not auto-populated, enter the related product request line item. 
    • Enter the destination, and if applicable, the source location. 
    • Enter the expected pickup date. 
    • After the transferred parts are received, select Received and update these fields: Quantity Received, and Status. (After you mark a product transfer received, you can’t undo it.) 
    • Click Save

  • Product item transactions describe actions performed on a product item. They’re auto-generated records that help you track when inventory is replenished, consumed, or adjusted. 
  • From the Product Transfer related list, Product Item Transaction.

Return orders
Return orders track the return of a product item due to damage, order errors, or other reasons. 
  • Create Return Orders for Field Service 
    • From the Return Orders tab or the Return Orders related list on a record, click New.
    • Enter an account and contact associated with the return order. 
    • Enter an associated product request. For example, if a mobile worker is returning an unused item, select the related product request that the product was intended to fulfill. 
    • In the Returned By field, select the user returning the items. 
    • Enter a source and destination location, if applicable. For example, if the return order tracks the return of products from a customer’s facility to your main warehouse, select the warehouse as your destination location. 
    • Enter a shipment type, address, and the date the returned products are expected to arrive at the destination location. The Ship from Address represents the location of the items at the start of the return or repair. For example, if a customer is returning an item, enter the customer’s address.
    • Click Save 

Return Order Line Items 
Return order line items are subdivisions of a return order. 
  • Create Return Order Line Items for Field Service 
    • From the Return Order Line Items related list, add a line item for each product being returned, Click New. 
    • To represent the items being returned, fill out one of more of the following fields: Asset, Order Product, Product, Product Item, and Product Request Line Item. 
    • Enter a quantity and unit of measure. If a product or product item is selected, the unit of measure is auto-populated. 
    • Select a reason for the return.
    •  In the Processing Plan field, indicate what should happen to the returned item. 
    • In the Repayment Method field, indicate how the owner should be reimbursed for the return. If the return order is tracking the return of items from van stock to an inventory location, you’ll probably leave this field blank. 
    • If needed, update the source and destination location. 
    • Click Save.

  • From the Product Transfer tab or the Product Transfer-related list on a Return Order Line Items, click New.  
  • Create a Record for Product Transfer for Return Order Line Items. 

  • Product item transactions describe actions performed on a product item. They’re auto-generated records that help you track when inventory is replenished, consumed, or adjusted. 
  • From the Product Transfer related list, Product Item Transaction. 


  • From the location Inventory Warehouse related Product Items decrease the quantity to 20 after transferring the return order.





If you have any questions you can reach out our Salesforce Consulting team here.

Thursday, 10 August 2023

LWC:Spread - Simplifying Data Passing Between Parent and Child LWC Components


In Lightning Web Components (LWC), one of the most crucial aspects is data communication between parent and child components. Passing data from the parent component to the child component is a common requirement in many scenarios. While there are multiple ways to achieve this, one approach that simplifies the process is using the "spread" operator. In this blog, we'll explore how to use the spread operator to pass data from a parent LWC component to a child LWC component. 

Why Use LWC:Spread? 

With the introduction of lwc:spread, you gain the ability to consolidate multiple properties into an object, allowing you to effortlessly pass this object to your child component. 

The greatest advantage of lwc:spread is that it promotes the sharing of properties within the object, rather than passing the entire object as a single attribute. This not only enhances performance but also facilitates a more organized and concise approach to managing component data. 


ParentLWC - The Parent Component 

The ParentLWC component template contains a lightning-card with a title and a lightning-button. We have defined a tracked property "arrayVal" to hold the data that we want to pass to the child component.


Parent JS 


Child Component 


Child JS


What if the “arrayVal” already contains some crucial Information? 

Below is the approach we can follow for that: 
Understanding the “SPREAD” Concept 

The "lwc:spread" directive in the parent component helps to pass the entire "arrayVal" object to the child component. By using the spread operator, the child component will receive the data directly as properties, and you do not need to explicitly pass each property individually. 

Output:


 

Conclusion 

In this blog, we explored how to use the "spread" operator to simplify data passing between parent and child LWC components. We saw how the parent component, "ParentLWC," passes data to the child component, "SpreadChild," by utilizing the "lwc:spread" directive. By using the spread operator, the child component can easily access the data as properties without the need for complex data passing mechanisms. 


This approach can enhance the maintainability and readability of your LWC code and make the communication between components more seamless. By applying this technique, you can improve your LWC development and create more efficient and modular Lightning Web Components. Happy coding! 


If you have any questions you can reach out our Salesforce Consulting team here.