Questions tagged [opportunity-lineitem]

An Opportunity can have associated OpportunityLineItem records only if the Opportunity has a Pricebook2. An OpportunityLineItem must correspond to a Product2 that is listed in the opportunity's Pricebook2.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

Query only OpportunityLineItems whose opportunity is open

I am very new to writing SOQL or APEX triggers I am currently writing an APEX trigger, that would update OpportunityLineItems whenever a Product2 is updated. Basically, it currently looks like this. ...
1
vote
1answer
19 views

Apex Batch Test Class for Opps with OLIs not returning values

I'm struggling with an Test Class for a little batch I created, let me clarify that I'm not a developer, so any tips will be appreciated. I wrote 2 versions of the class, the first gives me about 94% ...
-3
votes
2answers
57 views

Display opportunities associated with an OpportunityLineItem [closed]

I'm trying to display opportunities associated with an OpportunityLineItem on a Visualforce page on the OpportunityLineItem object I have a problem in the select I do not know how to retrieve the ...
0
votes
0answers
17 views

Opportunity product - Related list

I created a custom object : Discount__c ,that I want to link to Opportunity Product to see in each opportunity product all the discounts that there are on this product. Unfortunately we cannot ...
0
votes
2answers
55 views

how to create a trigger that will run when any opportunity line item is added or deleted from the opportunity? [closed]

I am new to apex programming and trying to learn it these days. I want to create a trigger that will run every time an OLI is added or removed from the opportunity. Which standard object is ...
1
vote
3answers
85 views

How to allow OpportunityLineItem delete but not Opportunity delete

How can I stop users from deleting Opportunity's but allow them to delete OpportunityLineItems? Because OpportunityLineItem is a child record of Opportunity it is not possible to control it's object ...
0
votes
1answer
25 views

OpportunityLineItem formula field is not getting correct values in Test class

I have a formula field in OpportunityLineItem -'Is Available'(IsAvailable__c) which takes values from product object's checkbox field -'Is Available' FORMULA : PricebookEntry.Product2.IsAvailable__c ...
1
vote
0answers
30 views

Selecting the Opportunity Price Book

I'm still fairly new to Salesforce Apex and trying to figure out how to select a price book from the opportunity. The reason being I have a trigger which adds in a product when the opportunity is ...
0
votes
0answers
18 views

after adding product to opportunity line item, the product do not display until and unless refresh the page

I have Embedded the Visualforce page on the Add Product button in lightning experience. when I am adding the product to opportunity, after adding I need to manually refresh the page again to appear ...
0
votes
0answers
93 views

Opportunity Line Item's Unit Price(quoted price) field update from related Product custom field

I have a requirement to update the Unit price(quoted Price) field of an Opportunity Line Item from the related Product Object custom field. And I need to perform this update when I am creating the ...
0
votes
0answers
33 views

Select Opportunity Product Instead re create them

I have a dynamic picklist (SelectOption) of PricebookEntry Which I build with a SOQL after selecting a product. after selecting few PricebookEntries - I need to create a new Opportunity and insert ...
1
vote
1answer
131 views

Formula on List Price for specific products

How can I use a formula to calculate list price based on custom fields for certain products? I though I could I set the list price at 0 since it's required then create a process builder to update the ...
0
votes
0answers
17 views

Dependent Opp Product

I have 4 new products to add, however 3 of them are dependent on the 1 other one being sold. How can I prevent sales reps from adding the 3 dependent products without adding the "parent" product above ...
0
votes
1answer
19 views

How to store only product type/range on Opportunity when specific product choice unknown?

Because it's not possible to change a product once added to an opportunity, what's the standard way to store product family, qty, specifications, etc. while customer decides on the specific product? ...
0
votes
1answer
254 views

Change the product of opportunity line item?

I am writing some code in apex that checks opportunitylineitems. In my code I am trying to clone some line items but change their product, but I cannot seem to. Code below: if(oli....
0
votes
1answer
56 views

How to copy Lead related objects to Opportunity when Lead Converted

I would like to copy all related Lead Products from Lead to OpportunityLineItems for the Opportunity when the Lead is converted. I thought there might be a base Apex class I could extend to ...
1
vote
1answer
326 views

How to customise columns in Add Products popup

Question How do I customise the columns that appear in the Add Products popup which appears if you click the Add Products button on the Products related list on the Opportunities record page? What I'...
2
votes
1answer
163 views

Update of quantity is modifying Sales Price but not Total Price

Can anyone help me out in understanding the below functionality. When i am trying to change Quantity on OopportunityLineItem, SalesPrice is getting change but not the Total Price. For Ex - Sales ...
0
votes
1answer
24 views

Divide OpportunityLineItem Quantity Schedule Evenly

I have a requirement where we need to insert OLIQuantity Schedule automatically. I need to divide the quantity evenly to the duration given. Like if Duration = 3 and productQuantity = 11, i need to ...
0
votes
0answers
30 views

unable to update UnitPrice field in Opportunity line item

I am executing following code to update UnitPrice in Opportunity line item: OpportunityLineItem oli = [SELECT UnitPrice FROM OpportunityLineItem WHERE Id = '00k8E000007TzxjQAC']; oli.UnitPrice = 10; ...
0
votes
1answer
30 views

Trying to do an SOQL Query for all product names and their Price books

I Have a Salesforce Org where there are almost 1000 products and 51 Price books, I want to know a query where I can get each product and the price books they belong to. Any help is much appreciated!
1
vote
1answer
140 views

How to overcome the lack of record type in opportunity Product?

I have a custom field in Opportunity Product called 'Unit of Measurement' and what I am trying to do is, show one value "Meter" as the default for users of one profile and "Square foot" as the ...
2
votes
1answer
92 views

How to calculate Custom TotalPrice in OpportunityLineItem

I have an scenario where I want an custom calculation for field "Totalprice" on OpportunityLineItem. I have written a trigger on OpportunityLineItem where first I am setting the UnitPrice value on ...
1
vote
0answers
88 views

Opportunity Product Lookup Filter [closed]

I was trying to replicate an object fields in my developer org and i came up with an object(which is a part of managed package) and a field of it has Lookup Relationship with Opportunity Product. How ...
1
vote
1answer
94 views

How are QuoteLineItems related to OpportunityLineItems

How does the QuoteLineItems Generated from the OpportunityLineItems, Can I add Fields that It can copy? How? I'm looking for a way to add fields to copy from the opportunity items to the quote items, ...
0
votes
1answer
12 views

Test button's action that adds OpportunityLineItem

I have a problem with one code's part. Controller (a part): public void click(){ for(WrapperClass wrp : wrapperRecordList){ if(wrp.isSelected){ ...
0
votes
1answer
60 views

If statement based on created by profile name to show value is custom formula field

This new field will be called "Line item Total Test" on Opportunity Product. This Formula is not working- IF(CreatedBy.Profile.Name = "Standard User", TotalPrice), IF(CreatedBy.Profile.Name = "...
1
vote
1answer
602 views

Are quote line items automatically created when inserting a quote in apex

I was reading this trailhead and it says quote lines are automatically created from the opportunity products when a quote is created. At this point, he selects the quote, and he sees that the ...
7
votes
1answer
282 views

SLEEPY Strikes again - Validation bugs

I've got a class which uses a wrapper class to handle OpportunityLineItem's which both have ids and don't have an id. Before calling an upsert on these records to update them, I extract the records ...
-1
votes
1answer
148 views

Trying to write a SOQL query that will pull the “product” name from the PricebookEntry on an opportunity line item

SO to clarify, The "name" on the OpportunityLineItem doesn't contain just the actual SKU, which is the "name" of the product. What I need to do is peel the onion back one more layer, and pull the ...
0
votes
1answer
346 views

Associating Asset records with Opportunity Product records

Our org has been storing serial numbers in an arbitrary text area field in the Opportunity Products object, delimited by arbitrary characters (commas, newlines, spaces, etc). This is very bad for a ...
1
vote
2answers
186 views

Aggregate result delete issue in trigger

Requirement : There is rollup (Sum) between opportunity and opportunitylineitem. Insert and update event is working fine but for delete event is not working correct. I have one opportunity and one ...
0
votes
1answer
36 views

List out of bounds 0 exception

I am trying to change the Opportunity Line Item schedule when a custom field is changed. The schedule works fine when the field is enterd, but when I edit the custom field it throws the exception. I ...
0
votes
1answer
53 views

Why does this Opportunity Validation Rule Evaluate to “Error”?

Validation Rule: GP_Locked__c && ISCHANGED(Total_GP__c) We are only editing the opportunity record, Ticking the GP_Locked__c Field (Boolean), for the purpose of locking the $GP amounts. And ...
2
votes
2answers
619 views

Automatically Linking Opportunity Product to Asset in Process Builder

I'm trying to create a process linking multiple Opportunity Products to an Asset, So that we can use it to know which products are part of what Asset. So far, this endeavour has multiple steps ...
0
votes
1answer
96 views

Adding a custom field from OppLineItem to a custom report type

I have a custom field on the OpportunityLineItem and want to show it in a custom report. Current setup: Custom Report Type: Invoices with Asset OpportunityLineItem- child of Opportunity Invoice - ...
0
votes
0answers
328 views

Lightning Action on Opportunity Product

I need to add a Lightning action on Opportunity Product. After some research, I have found that it is not possible. Anyone ever got this issue? Any workaround?
0
votes
2answers
340 views

Trigger to update fields on record create or edit

I have a trigger on the OpportunityLineItem object that we use to update 4 revenue fields with specific calculations when the record is either created or updated. For some reason it seems the trigger ...
-2
votes
1answer
64 views

iam inserting an Opportunity record, but I need it to have HasOpportunityLineItem = true (HasOpportunityLineItem read only field)

iam inserting an Opportunity record, but I need it to have HasOpportunityLineItem = true (HasOpportunityLineItem read only field) present HasOpportunityLineItem = false but i need to ...
0
votes
0answers
67 views

QuoteLineItems Stop Adding Opportunity Products

We need to be able to add opportunity products without adding them to the quotelineitems. This is because our special pricing desk needs to inspect each product before it is added to an appended ...
-1
votes
1answer
351 views

Find duplicate opportunity with process builder

I am working on a requirement when a "deal" opportunity is closed, we need to create a "target" opportunity if a target opportunity does not exists in the system (Deal and Target are the record types)....
0
votes
1answer
285 views

Validation rule on OpportunityLineItem (opportunity product)

On a visualforce page, I am creating an opportunity and I am adding an OpportunityLineItem (opportunity product) to it. The product2 linked to the opportunity product has a field called ...
-4
votes
2answers
262 views

How to solve Error: Compile Error: Field is not writeable error for ListPrice Field on opportunity Line Item

I am trying to assign the List Price field on OpportunityLineItem to 0 using trigger but receiving the Compile Error as: Field is not writable error. for(OpportunityLineItem oli: trigger.new) { ...
0
votes
2answers
360 views

SOQL to get the last updated product in an opportunity

Trying to edit this SOQL so that it picks up the last updated product in an opportunity. Any idea how? Right now it is giving me the very first product that was created. PricebookEntry pbeProduct2 = [...
0
votes
0answers
137 views

Creating QuoteLineItem after creating Opportunity Line Item

I have created a webservice to create Opportunity, OpportunityLineItem and related Quote. When I do the same activity in configuration. QuoteLineItem gets created automatically. But when i do that ...
0
votes
2answers
1k views

Visualforce page to display opportunities along with their products

I am currently working on a Visualforce page to completely recreate and customize salesforce's 'customizable forecast' tab to make it work with our instance of CPQ as well as make a few business-...
0
votes
2answers
476 views

SOQL to update a field of an OpportunityLineItem in the opportunity in use

Trying to update an OpportunityLineItem, but need to be able to look for that particular product in the opportunity. Problem: SOQL is using the List Price from the product but from a different ...
0
votes
3answers
536 views

Create Asset record from data on OrderItem and OpportunityLineItem records

Scenario: When an Opportunity is closed/won, we are creating an Order record with the corresponding OrderItem records based on the OpportunityLineItems of the Opportunity. When the OrderItems are ...
0
votes
1answer
30 views

Method does not work without formula

I have an after insert method on OpportunityLineItem that I'm writing a test class for. A problem that I had is I couldn't get the test to assert on the list passed to it because a formula was null ...
1
vote
1answer
148 views

Locking “Quantity” and “Sales Price” once opportunity is WON

I have the following validation rule to prevent users from editing or creating products once the opportunity is won. The issue is that it can still be edited if they click on "edit all" in the ...