(UnitPrice - (UnitPrice * Discount)) * Quantity.This error typically happens in a record-triggered Flow(In Salesforce Sales Cloud) because the running user lacks the necessary Field-Level Security (FLS) to edit the UnitPrice or Quantity fields on the Opportunity Product object. The solution in this article is designed to bypass user permission issues entirely by having the record created in System Context. This avoids the need to grant specific FLS to the running user's profile or permission sets.
What is Field Level Security?
Field-Level Security (FLS) in Salesforce is a visual and data access control mechanism that allows administrators to restrict a user's ability to view and edit specific fields on a record, regardless of their object-level permissions. Unlike Record-Level Security, which determines which records a person can see, FLS determines what data within those records is accessible.
It is primarily managed through Profiles and Permission Sets, offering two settings: "Read-Only," which permits viewing but prevents modifications, and "Visible," which allows both viewing and editing. If a field is hidden via FLS, it is completely removed from page layouts, search results, reports, and list views for that user, ensuring that sensitive data like social security numbers or salary information remains confidential.
Because TotalPrice is a read-only, calculated field (Quantity x UnitPrice), the two resolutions often suggested—granting edit access to TotalPrice or running the flow in system mode—are not viable:
You cannot grant edit access to a calculated field. This is standard behavior for calculated fields in Salesforce, as detailed in the official OpportunityLineItem object documentation.
A standard record-triggered Flow that runs before the record is saved cannot be configured to run in "System Context." For more details on this behavior, see the Help article: Flow Behavior for Read-Only Fields.
The correct solution is to use a record-triggered Flow to launch a subflow that runs asynchronously in System Context to complete the record creation.
The solution involves two parts: a main record-triggered flow and an autolaunched subflow that it calls.
This flow will run in System Context and is responsible for creating the Opportunity Product record.
Create a new Autolaunched Flow (No Trigger).
In the Flow's start properties, under "Advanced," check the box to run the flow in System Context without Sharing—Access All Data.
Create the necessary input variables to receive data from the main flow (e.g., input_OpportunityId, input_PricebookEntryId, input_Quantity, input_UnitPrice).
Add a Create Records element to create the OpportunityLineItem record, mapping your input variables to the corresponding fields (OpportunityId, PricebookEntryId, Quantity, UnitPrice).
Save and Activate this subflow.
This flow will trigger when your initial criteria are met and will pass the required data to the subflow.
Create a new Record-Triggered Flow that runs when your business process requires (e.g., when an Opportunity stage changes).
Configure the flow to run Asynchronously. This is required to call a subflow that runs in System Context.
Add a Subflow element to the canvas.
Select the autolaunched subflow you created in Part 1.
Map the necessary data from your triggering record or other sources into the subflow's input variables.
Save and Activate the main flow.
000390771

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.