• CuriousJohn
  • NEWBIE
  • 25 Points
  • Member since 2013

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

I want to include a Custom Setting in a package **and** two instances (records) of the Custom Settings Object. Is that possible?

The standard technique for accessing Document Tab files in Apex is not working for me.

 

Here's the code I'm using:

 

List<Document> docs;
docs = [select id, name, body from Document 
       where name = 'Donations_Test_Data']; 
 

 

Donations_Test_Data is the "Document Unique Name" (i.e. API name) of a CSV file stored in the Documents Tab. This SOQL query produces zero (0) records of output.

 

The log looks like this:

 

07:41:45.283 (283369000)|SOQL_EXECUTE_BEGIN|[372]|Aggregations:0|select id, name from Document where name = 'Donations_Test_Data_XXX'
07:41:45.292 (292463000)|SOQL_EXECUTE_END|[372]|Rows:0

 

I need to be able to access this test data programmatically in order to get test coverage.

I'm trying to upsert an Object that has required Picklist Fields.

 

I've written code that constructs a list of Ooportunities objects that I want to upsert in an Apex controller:

 

public List<Opportunity> DonationData = new List<Opportunity>();
upsert DonationData;

 

But there's a required Picklist field called Stage in the Opportunity Object and I must load this field or the upsert operation fails with this error:

 

Error:
Required fields are missing: [Opportunity Name, Stage]

 

The Stage field is not important to me, and so. I have been trying put stub data in it:

* Integers 0 & 1 don't work

* String 'Close Won' doesn't work

 

There is no PickList object, to my knowledge, so there are no Picklist methods.

 

QUESTION: How do you assign a picklist value programmatically?

 

The standard technique for accessing Document Tab files in Apex is not working for me.

 

Here's the code I'm using:

 

List<Document> docs;
docs = [select id, name, body from Document 
       where name = 'Donations_Test_Data']; 
 

 

Donations_Test_Data is the "Document Unique Name" (i.e. API name) of a CSV file stored in the Documents Tab. This SOQL query produces zero (0) records of output.

 

The log looks like this:

 

07:41:45.283 (283369000)|SOQL_EXECUTE_BEGIN|[372]|Aggregations:0|select id, name from Document where name = 'Donations_Test_Data_XXX'
07:41:45.292 (292463000)|SOQL_EXECUTE_END|[372]|Rows:0

 

I need to be able to access this test data programmatically in order to get test coverage.

Hi All,

 

We can access static resources in visualforce page as follows;

{!URLFOR($Resource.UploadTemplate)}

 

How can we access the static resource in APEX class?

 

Thanks in Advance!