function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jordan HunterJordan Hunter 

Product Stock Management

I have a very large customer requirement in which they have products and a customer object related to Cases that references those products (when they are used in a case).

What they would like to do is have a related object to products to capture stock available, having a custom object would allow me to have batches and batch numbers which is why ive chosen that way over just a quantity field on the product. 
Then be able pick them when completing a repair, and have the counters be dynamic, updating when stock is replensihed and decreasing when they are consumed. 
Anyone have any thoughts how i could best complete this?

Julien SalensonJulien Salenson
Hi Jordan,

I always start a project by looking to see if there's an app on the appexchange that can meet my needs.
And it seems that there are several possible solutions, look here :
https://appexchange.salesforce.com/appxSearchKeywordResults?keywords=manage%20stock

Otherwise, you can develop it yourself, but it'll take longer.
You can follow these steps:
Custom Object for Stock Management:
Create a custom object, let's call it "Stock" or something similar, to manage stock levels for each product. This custom object should have fields like Product (Lookup to Product), Quantity in Stock, Batch Number, and any other relevant fields to track stock.

Relationships:
Ensure that you establish the necessary relationships between your objects:
Create a lookup field on the Stock object to relate it to the Product.
Create a lookup field on the Case object to relate it to the Product used in that case.
You can also create a related list on the Product object to display associated Stock records.

Stock Management Logic:
Implement the logic for managing stock levels. This can be done through automation such as Process Builder, Workflow Rules, or Apex triggers. Here's a simplified outline:
When a Case is created and related to a Product, trigger an update to the associated Stock record(s) to decrease the quantity in stock.
When a Case is resolved or completed, you can trigger an update to increase the quantity in stock if the product is returned or replenished.
You may need to consider additional rules for managing stock levels based on various scenarios specific to your business processes.

Dynamic Counters:
To keep the counters dynamic, you can use formulas or triggers to calculate and update the stock levels based on the relevant actions (e.g., cases being created, resolved, or stock replenishment). You can also use a scheduled job to periodically recalculate and update stock levels.

Batch Tracking:
Use custom fields on the Stock object to capture batch numbers, manufacturing dates, and other relevant batch information. This will allow you to track stock at a granular level.

Reporting and Dashboards:
Create reports and dashboards to provide visibility into stock levels, usage, and trends. This will help your team make informed decisions about stock management.

Security and Permissions:
Ensure that your Salesforce security model is set up appropriately. Restrict access to stock management records based on user roles and profiles to maintain data integrity.

Testing and Validation:
Thoroughly test your solution to ensure that it meets your requirements and that stock levels are accurately maintained.

User Training:
Train your users on how to interact with the Stock object and related processes, especially those responsible for managing stock levels.



Thanks for liking my comment if it helps you.