• puli raju
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 14
    Questions
  • 0
    Replies

After reading tons of links, posts and many documents, I decided to ask for help here, hopping some guru can help me with this issue:
 

<!-- Visualforce Remote object component for Products -->
<apex:remoteObjects >
<apex:remoteObjectModel name="PriceBookEntry" jsShorthand="Prod" fields="id, Name, Pricebook2Id, UnitPrice, IsActive">
</apex:remoteObjectModel>
</apex:remoteObjects>

I have done this javascript fuction to display records from PriceBookEntry Object using remoteObject in Javascript:

function fetchPB(){var wh = new SObjectModel.Prod();
    wh.retrieve({
      where:{
            Pricebook2Id : {eq:'01so0000002r3TBAAY'}, 
            IsActive : {eq:true},
            UnitPrice : {gt: 0}
      },
      limit: 5
      },function(err, records){
        if(err) alert(err.message);
        else {
          records.forEach(function(record) {             
            var divCol = $('<div class="row">');
            var p = record.get("Pricebook2Id");
            alert('row => ' + record.toString());
            var detail = $('<p>'+record.get("Name")+'<br/></p>');           
            var link1 = $('<p><br/><input type="check" name="optCheck"></p> ');
            link1.click(function(){              
              $('#inputProduct2').val(record.get("UnitPrice"));
            });
            detail.append(link1);
            h3.append(detail); 
            divCol.append(product);
            divCol.appendTo('#prodRow');
          });
        }
      });      
}

When I execute this function I can see in the developer console of my browser the post action and the data is coming from the server

User-added image
Even I see the data is coming I can't get the object's values, if I display a javascript alert with the object information I can't see values only this:

User-added image

I'm prety sure this answer will be not only a big help for me but for the entire SF comunity.

Thanks in Advance.