• jonesy74
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi, I am using asp.net vb and I am returning a results of object from this query

 qr = x.query("SELECT Amount, Id, Name, (SELECT Quantity, ListPrice, PriceBookEntry.UnitPrice, PricebookEntry.Name, PricebookEntry.product2.Family FROM OpportunityLineItems)FROM Opportunity where  Opportunity.Pricebook2Id<> null")


I am trying to list the "ListPrice" from the sub query, I can see it in the object explorer but do not know know how to reference it, in the code below it is the variable price2 that I am trying to assign to "listprice". I have tried attempting to cast  the query result record to "OpportunityLineItem" but get errors, also tried using a function call GetPrice but still casting errors. Can someone please point me in the right direction.


  dt.Columns.Add(New DataColumn("Id"))
                dt.Columns.Add(New DataColumn("Oppurtunity Name"))
                dt.Columns.Add(New DataColumn("Price"))
              
                Do While (i < qr.records.Length)
                    Opportunity = CType(qr.records(i), Opportunity)
                    id = Opportunity.Id
                    Name = Opportunity.Name
                    Price = Opportunity.Amount
                    Dim price2 = Opportunity.OpportunityLineItem.listprice
                    dt.Rows.Add(id, Price, Name)
                    i = (i + 1)
                Loop



 Function GetPrice(ByVal qr As sforce.QueryResult)
        Dim OpportunityLineItem As New sforce.OpportunityLineItem

        If qr.size > 0 Then
            Dim Product2 = CType(qr.records(0), OpportunityLineItem)
            Return OpportunityLineItem.ListPrice
        End If

    End Function
Hi all,
 
I need to detect any price change of products and then use the data of an change product to update an external database - so is has to be near realtime and a "polling" scenario in certain intervals won't work.
 
As far as I found out, one can neither create a workflow on the "pricebookEntry" object (together with an outgoing call), nor does Apex allow to define a trigger on "pricebookEntry".
 
Is there any other way that might be usable to trigger an external script as soon as a product price has been changed?
 
TIA & Cheers,
Harry
 
 
  • January 15, 2008
  • Like
  • 0