• Susand Adame
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I'm trying to query VersionData to get a base64 representation of a file. It works in workbench (I get a really long field), but when I query it in my React Native sample app created with forceios (using SDK 4.3) I just get the following as the result:

/services/data/v36.0/sobjects/ContentVersion/{id of file}/VersionData

When I paste that URL into REST Explorer and do a get, I just get:

Raw Response
1


If I log into salesforce.com and paste that url after the .com, I get the following:
 
<Errors>
  <Error>
    <errorCode>INVALID_SESSION_ID</errorCode>
    <message>Session expired or invalid</message>
  </Error>
</Errors>

Any idea why this could be and how to get the data I want?  Thanks.
I want to use Apex code and visualforce page to create a new lead.

In web, I need to choose a record type before I create a new lead. And there are three types of leads.
In visualforce page, I want to create a new lead with assigned record type using code.

The confusion for me is that the recordType is related list for the lead. I could extract a list of record type by the following.

for (list<RecordType> rts : [SELECT ID, name FROM RecordType WHERE SObjectType = 'Lead' Order by name])

However, I could not pull out the recordType for a lead by the following, since the recordType is related list.

Lead l = [SELECT RecordType FROM LEAD].

Besides, what I want is create a new lead like below.
Lead l = new Lead(firstname='testInsertLead2', lastname='test',company='Temp Company', RecordType = 'registration type lead');

Could anyone help me with this to access the related list using apex code or visualforce page?

Thanks a lot.