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
ScotScot 

Problems inserting a new PriceBookEntry

I am not sure whether this is a problem of the COM Toolkit, my usage, or the API in general, but I'm finding it impossible to add new PriceBookEntry instances.

I am currently working on isolating the offending code so I can give a reproducable problem here, but would like to describe the symptoms, in the hope that someone has run into a similar problem and can give me a hint towards a solution.

I am using generic Excel code which uses the CreateObject function to build an object, assigns values into the field(n).value's, and then uses DoCreate to process it. This code has worked fine, unchanged, for at least 20 other object types, but is failing for PriceBookEntry.....

The failure occurs when assigning a value to, it appears, ANY of the fields in the object. I've tested it with Product2ID, Pricebook2ID, and the currency value. The result of the assignment statement, of the form:
        .....  fldobject.value="value"
is:

    "Runtime error '-2147467529 (8004005)'
    "The current field definition for Product2ID does not allow you to set a value"

As expected for the Product2ID,
              fldobject.createable = TRUE  and
              fldobject.updateable = FALSE

Any help or suggestions appreciated.

DevAngelDevAngel

Hi Scot,

Verify that the user you are using to login is in a role that has Manage Products permissions.

ScotScot

Hello Dave,

Yes, the user is an Administrator, with full permissions.
By confirmation, an UPDATE of an existing priceBookEntry works fine.

Scot

ScotScot

Ok, here is a reduced case:

Sub sms()
  oksession = SessionMe    '  call to create / verify an active session
  Dim so As SObject 
  Set so = salesforce.CreateEntity("priceBookEntry")      ' does CreateObject call (see below)
  so.Fields(2).value = "USD"                                             ' CurrencyIsoCode: fails '
  so.Fields(9).value = "01t000000000bunAAA"                 ' Product2Id, also fails 

  '  Call salesforce.DoCreate(sobs)                                  ' would do Create

End Sub

DevAngelDevAngel

Hi Scot,

This is evidently a bug.  We will have it resolved for GA.

ScotScot

Can you give me any idea when this GA will be?

Understand, I am not trying to build a new feature ... I am trying to keep our existing salesforce.com production system working using what should have been a replacement for the XML-RPC facilities I was previously using.

chisholmdchisholmd

I am having the exact same issue but when trying to add an OpportunityLineItem.  When I look in salesforce setup, each of the fields I get the error on is listed as a 'lookup' type.  Is there some special procedure for specifiying foriegn keys like this?

I am using the oficeToolKit and I see a 'PickListValue' class but have no idea if I should be using it or how. 

(This is what I meant when I told my client about unforseeable issues, hope they are understanding

 

 

ScotScot

!%&*#!$%&

It sure looks like the same type of problem.

If misery loves company ... you've got it.  I cured my earlier problem by using a different import tool - but my next step was to delete all the existing opportunity line items, change opportunities to a new price book, and replace the line items with ones from the new price books. This will not be feasible with the import tool - nor with this problem.

It appears that you're not allowed to set the Opportunity ID when inserting a new line item ...

chisholmdchisholmd

I appriciate the company

I only get the error on picklist field types, maybe we have to do something differently to set those values..lookup a value in an intermediate table maybe ???

I am trying to remember to extend the same patience to sforce as I hope to get from my clients   The fact is that in an evolving system thier developers are probably working too fast for the documenters to keep up

For my solution I may need to just reverse my logic and extract values from sforce into a standalone billing systems rather then add valeus to it. Just as an interim solution.

Cheers