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
Venk_ModelMetriVenk_ModelMetri 

Question about the Opportunity Record - Relationship with Products & Schedules

We are thinking about writing a Java Batch process that will read the opportunity records and update them. While updating, is it possible for us to delete and add the products associated with that opportunity in Products (Standard) section of an opportunity. Also, how would you add the newly created products to a schedule automatically ?

 

Does the API support this?

 

Thanks

Venk

DevAngelDevAngel

Hi Venk,

Products are added to opportunities view OpportunityLineItems.  A line item is created and the opp id is set to the opportunity you are adding the product to, the product id is set to the appropriate product.

The product table can be fully manipulated from the API (Add, update delete).

 

Venk_ModelMetriVenk_ModelMetri

Dave,

Thank you so much. I am looking at the OpportunityLineItems object and its seems like a perfect fit. Just to make sure that I understand this correctly.

 

When I have an opportunity object in my java program, can I acess the OpportunityLineItems by saying something like opportunity.getOpportunityLineItems ? (If not, how I get the OpportunityLineItems associated with the current opportunity record.)

 

Similarly, when I do a an update opportunity call, will the OpportunityLineItems associated with the opportunity automatically get updated or would I have to make another call for that?

Thanks

Venk

 

 

 

DevAngelDevAngel

Hi Venk,

You would query for OpportunityLineItems by using a query like "Select Id From OpportunityLineItems where OpportunityId = '00300000JJCK'".

The line items and opportunities are updated independently.

 

Venk_ModelMetriVenk_ModelMetri

Dave,

When adding a product (OpportunityLineItem) and associating it with an opportunity, our requirement is that we should also add it to the schedule automatically (opportunityLineItemSchedule).

If a product has a default schedule already enabled, should we make any extra call to opportunityLineItemSchedule or does this happen automatically?

How will the query be like (just to get a feel for it) if we have do this explicitly ?

Thank You

Venk