• Nicolas Dupuis
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all,

I am trying to do a mass update of formulas on Opportunity Line Items. I wanted to use recalculateformulas() but got an error.

Here is my script:
List<OpportunityLineItem> opportunitylineitems = [select id from OpportunityLineItem where PricebookEntry.Pricebook2Id = '01s20000000UD8hAAG'];
for (OpportunityLineItem oli : opportunitylineitems) (
oli.recalculateFormulas());

And here is the the error message:

Line: 3, Column: 1
System.UnexpectedException: Unable to create/update fields: CurrencyIsoCode, PricebookEntryId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.

Any help would be appreciated.

Thanks
Hi all,

I am trying to do a mass update of formulas on Opportunity Line Items. I wanted to use recalculateformulas() but got an error.

Here is my script:
List<OpportunityLineItem> opportunitylineitems = [select id from OpportunityLineItem where PricebookEntry.Pricebook2Id = '01s20000000UD8hAAG'];
for (OpportunityLineItem oli : opportunitylineitems) (
oli.recalculateFormulas());

And here is the the error message:

Line: 3, Column: 1
System.UnexpectedException: Unable to create/update fields: CurrencyIsoCode, PricebookEntryId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.

Any help would be appreciated.

Thanks