• pluviosilla
  • NEWBIE
  • 25 Points
  • Member since 2011

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

Strangest thing. I can generate Tasks programmatically in an Apex Visualforce controller without any problem, but if I use the identical code in an Apex trigger, I get a strange behavior. The Task object is created but not assigned to the Contact until I assign a Task that same Contact from some other source, and then - poof - the previously created Task objects suddenly show up on the Contact's detail page.

 

Here's the code in the trigger (NOTE that I am using a hardcoded ID for the Contact):

 

// This method will create a task
public void createTask()
{
    Task t = new Task(WhoId = '003Z000000WzJOt',
                                  Type = 'General Task',
                                  Subject = 'Create task for contact',
                                  Description = 'Description');
    try {
        insert t;
    } catch (DmlException e) {
        ApexPages.addMessages(e);
    }
}

 

I hesitate to add the code in the Apex Visualforce controller, because it is almost identical. The only difference is the return value of the method (PageReference instead of void):

 

public PageReference createTask() {
    Task tmpTask;
    tmpTask = new Task(WhoId = '003Z000000WzJOt',
                                     Type = 'General Task',
                                     Subject = 'subject text',
                                     Description = 'Description');

    try { 

        insert tmpTask;
    } catch (DmlException e) {
        ApexPages.addMessages(e);
        System.assert(false); // assert that we should never get here
        return null;
    }
    return null;
}

I'm getting a really strange error spew when I try to save files to the server in the Force.com IDE. Here's the message:

 

Problem Saving Apex Code to Server in Force.com IDE: ServiceException: LIMIT_EXCEEDED

 

Unable to save resource ‘src’ to server: ServiceException: LIMIT_EXCEEDED: java.sql.SQLExcepton: ORA-20526:
ORA-06512: at “SLEEPY.CCUSTOMINDEX”, line 275
ORA-06512: at line 1
:{call cCustomIndex.insert_detail(?,?,?,?,?,?,?,?,?,?,?)} (LIMIT_EXCEEDED)

 

Reason:

LIMIT_EXCEEDED: java.sql.SQLException: ORA-20526:

ORA-06512: at “SLEEPY.CCUSTOMINDEX”, line 275
ORA-06512: at line 1
:{call cCustomIndex.insert_detail(?,?,?,?,?,?,?,?,?,?,?)} (LIMIT_EXCEEDED)

 

Any idea what might be causing this?

 

Again, I'm not running the app. I'm simply trying to upload code that shows no syntax errors.

I can't figure out what I'm doing wrong.

 

I have an instance op of an Opportunity object and the following code:

 

System.debug('@@@@@@@@@@@@ The year is: ' + nYear);
System.debug('@@@@@@@@@@@@ The month is: ' + nMonth);
System.debug('@@@@@@@@@@@@ The day is: ' + nDay);
Date dt = Date.newInstance(nYear, nMonth, nDay);
System.debug('@@@@@@@@@@@@ The complete date is: ' + dt); 
op.CloseDate = dt;

 This appears to work fine and produces the expected spew in the Developer Console:

 

[392]|DEBUG|@@@@@@@@@@@@ The year is: 12
[394]|DEBUG|@@@@@@@@@@@@ The month is: 11
[396]|DEBUG|@@@@@@@@@@@@ The day is: 28
[398]|DEBUG|@@@@@@@@@@@@ The complete date is: 0012-11-28 00:00:00
etc. (same for multiple Opportunity records)

 

But when controller attempts to upsert these Opportunity records a DML error occurs with an error message complaining that value in CloseDate is not a valid date.

 

Close Date: Close Date: invalid date: Mon Nov 28 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 05 00:00:00 GMT 12
Close Date: Close Date: invalid date: Tue Nov 01 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 06 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 09 00:00:00 GMT 12
Close Date: Close Date: invalid date: Thu Nov 10 00:00:00 GMT 12
Close Date: Close Date: invalid date: Fri Nov 11 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 12 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 13 00:00:00 GMT 12
Close Date: Close Date: invalid date: Mon Nov 14 00:00:00 GMT 12
Close Date: Close Date: invalid date: Mon Nov 21 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 23 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 26 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 27 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 30 00:00:00 GMT 12

 

None of the Opportunity records are inserted into the database. All of them fail for this sole reason. I know that the date is the only problem, because the upsert works just fine if I hard code a date with a statement like this:

 

op.CloseDate = Date.parse('12/27/2009');

 

 

I'm new to packages. I want to deploy a package in multiple orgs and 

(1) automatically add new custom fields to the Opportunities and Contacts standard objects during the installation of the package, while *taking* *extreme* care*

(2) **not** to remove any custom fields that the person installing my package may have already added to those objects. Also, it would be nice if I could ensure that

(3) if someone decides to *uninstall* my package, it will delete those fields (and *only* those fields) which my package added during installation.

 

How do I achieve (1) and (2)?

 

I was really surprised to learn that Professional Edition Users are not allowed to make Custom Profiles!!

 

How can this be?

 

A Standard User Profile HAS NO CRUD PERMISSIONS on Custom Objects, which means that in PE a Standard User won't even be able to View records based on Custom Objects, much less create / modify them.

 

What am I missing here? This seems far too restrictive. Or Have I misunderstood what a Professional Edition License is? 

I want a VF web tab to navigate to a specific record, and so I defined the VF page ("TestNameExperiment") like this:

 

<apex:page standardController="My_Custom_Object__c"

                              action="{!URLFOR('/apex/TestNameExperiment?id=a0bE0000000PCIC')}" >

 

where a0bE0000000PCIC is the record ID.

 

This caused an infinite loop in which the VF page loads over and over again, which makes sense in hindsight.

 

What's the proper way to do this?

 

 

I'm having trouble finding the right binding expression for a VF page. Here's a snippet:

 

<apex:pageBlock title="Example pageBlockTable">

    <apex:pageBlockTable value="{!accounts}" var="item">

 

THESE WORK:

 

            <apex:column value="{!item.name}"/>

            <apex:column value="{!item.owner.name}"/>

 

But NONE OF THESE REFERENCES TO CHILD FIELDS WORK

            <apex:column value="{!item.contracts.lastname}"

            <apex:column value="{!item.contract.lastname}"

            <apex:column value="{!item.lastname}"

            <apex:column value="{!item.contracts[lastname]}"/>       

 

</apex:pageBlockTable>

 

Here's my controller:

 

public class CtrlrTestDataTables {
    List<Account> accounts;
    public List<Account> getAccounts() {       

        if(accounts == null) accounts =

           [select name, owner.name,                              

                (select contact.firstname, contact.lastname from contacts)

                 from account];           

        return accounts;   

    }    

}

 

 

I'm preparing for the Developer Certification and trying to understand the Sharing Model. Looks to me like Cases is the only object for which you can define Assignment and Escalation rules. Is this correct?

 

Couldn't the Assignment Rule functionality have been implemented in a Sharing Rule?

 

 

I have quite a few legacy Excel spreadsheets each of which has a large number of columns. If I have to use the Setup Menu to create objects with that many fields it will be a VERY TIME-CONSUMING process.

 

Is there no way to import an entire table schema programmatically without having to first define the schema in the Salesforce database using the Setup menu?

 

Is there nothing similar to an .sql script file like that available in MySQL that allows one to generate a schema programmatically?

 

Is there some way to directly edit meta data in Eclipse and GENERATE NEW OBJECTS in the Salesforce database?

 

Help!!

 

John (pluviosilla@gmail.com)

I have some legacy Excel spreadsheets each of which has very large number of columns, and I'd like to migrate this data to Salesforce. If I use the Setup menu, it will be VERY TIME CONSUMING to create the objects with the required number of fields.

 

Can Excel Connector create these objects from scratch without any prior-existing object schema in the Salesforce database?

 

Or is there, perhaps, a  way to do this by combining an Excel Connector operation with direct edits to the Meta Data in Eclipse?

 

Thanks,

John (pluviosilla@gmail.com)

Newbee Question: I have some legacy Excel files with very large numbers of columns. It would be VERY TIME CONSUMING to use the Setup menu to create the schemas for the objects I want to populate with data, so I was hoping I could use either Dataloader or the Import wizard to import an object that is completely new (i.e. that does not already have a schema definition in Salesforce).

 

When I run Dataloader:

(1) Object rerquired: It insists that I specify an existing object, but

(2) Undefined fields: it appears, at first, to accept a CSV file with new columns (for which there are no predefined fields)

 

The import runs smoothly without errors, but I see nothing in the database.

 

Please tell me if what I am attempting is even possible. If not, is there a 3rd party application that does this?

 

Thanks,

John (pluviosilla@gmail.com)

Strangest thing. I can generate Tasks programmatically in an Apex Visualforce controller without any problem, but if I use the identical code in an Apex trigger, I get a strange behavior. The Task object is created but not assigned to the Contact until I assign a Task that same Contact from some other source, and then - poof - the previously created Task objects suddenly show up on the Contact's detail page.

 

Here's the code in the trigger (NOTE that I am using a hardcoded ID for the Contact):

 

// This method will create a task
public void createTask()
{
    Task t = new Task(WhoId = '003Z000000WzJOt',
                                  Type = 'General Task',
                                  Subject = 'Create task for contact',
                                  Description = 'Description');
    try {
        insert t;
    } catch (DmlException e) {
        ApexPages.addMessages(e);
    }
}

 

I hesitate to add the code in the Apex Visualforce controller, because it is almost identical. The only difference is the return value of the method (PageReference instead of void):

 

public PageReference createTask() {
    Task tmpTask;
    tmpTask = new Task(WhoId = '003Z000000WzJOt',
                                     Type = 'General Task',
                                     Subject = 'subject text',
                                     Description = 'Description');

    try { 

        insert tmpTask;
    } catch (DmlException e) {
        ApexPages.addMessages(e);
        System.assert(false); // assert that we should never get here
        return null;
    }
    return null;
}

I can't figure out what I'm doing wrong.

 

I have an instance op of an Opportunity object and the following code:

 

System.debug('@@@@@@@@@@@@ The year is: ' + nYear);
System.debug('@@@@@@@@@@@@ The month is: ' + nMonth);
System.debug('@@@@@@@@@@@@ The day is: ' + nDay);
Date dt = Date.newInstance(nYear, nMonth, nDay);
System.debug('@@@@@@@@@@@@ The complete date is: ' + dt); 
op.CloseDate = dt;

 This appears to work fine and produces the expected spew in the Developer Console:

 

[392]|DEBUG|@@@@@@@@@@@@ The year is: 12
[394]|DEBUG|@@@@@@@@@@@@ The month is: 11
[396]|DEBUG|@@@@@@@@@@@@ The day is: 28
[398]|DEBUG|@@@@@@@@@@@@ The complete date is: 0012-11-28 00:00:00
etc. (same for multiple Opportunity records)

 

But when controller attempts to upsert these Opportunity records a DML error occurs with an error message complaining that value in CloseDate is not a valid date.

 

Close Date: Close Date: invalid date: Mon Nov 28 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 05 00:00:00 GMT 12
Close Date: Close Date: invalid date: Tue Nov 01 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 06 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 09 00:00:00 GMT 12
Close Date: Close Date: invalid date: Thu Nov 10 00:00:00 GMT 12
Close Date: Close Date: invalid date: Fri Nov 11 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 12 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 13 00:00:00 GMT 12
Close Date: Close Date: invalid date: Mon Nov 14 00:00:00 GMT 12
Close Date: Close Date: invalid date: Mon Nov 21 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 23 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sat Nov 26 00:00:00 GMT 12
Close Date: Close Date: invalid date: Sun Nov 27 00:00:00 GMT 12
Close Date: Close Date: invalid date: Wed Nov 30 00:00:00 GMT 12

 

None of the Opportunity records are inserted into the database. All of them fail for this sole reason. I know that the date is the only problem, because the upsert works just fine if I hard code a date with a statement like this:

 

op.CloseDate = Date.parse('12/27/2009');

 

 

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?

 

I'm new to packages. I want to deploy a package in multiple orgs and 

(1) automatically add new custom fields to the Opportunities and Contacts standard objects during the installation of the package, while *taking* *extreme* care*

(2) **not** to remove any custom fields that the person installing my package may have already added to those objects. Also, it would be nice if I could ensure that

(3) if someone decides to *uninstall* my package, it will delete those fields (and *only* those fields) which my package added during installation.

 

How do I achieve (1) and (2)?

 

I want a VF web tab to navigate to a specific record, and so I defined the VF page ("TestNameExperiment") like this:

 

<apex:page standardController="My_Custom_Object__c"

                              action="{!URLFOR('/apex/TestNameExperiment?id=a0bE0000000PCIC')}" >

 

where a0bE0000000PCIC is the record ID.

 

This caused an infinite loop in which the VF page loads over and over again, which makes sense in hindsight.

 

What's the proper way to do this?

 

 

I'm having trouble finding the right binding expression for a VF page. Here's a snippet:

 

<apex:pageBlock title="Example pageBlockTable">

    <apex:pageBlockTable value="{!accounts}" var="item">

 

THESE WORK:

 

            <apex:column value="{!item.name}"/>

            <apex:column value="{!item.owner.name}"/>

 

But NONE OF THESE REFERENCES TO CHILD FIELDS WORK

            <apex:column value="{!item.contracts.lastname}"

            <apex:column value="{!item.contract.lastname}"

            <apex:column value="{!item.lastname}"

            <apex:column value="{!item.contracts[lastname]}"/>       

 

</apex:pageBlockTable>

 

Here's my controller:

 

public class CtrlrTestDataTables {
    List<Account> accounts;
    public List<Account> getAccounts() {       

        if(accounts == null) accounts =

           [select name, owner.name,                              

                (select contact.firstname, contact.lastname from contacts)

                 from account];           

        return accounts;   

    }    

}

 

 

I'm preparing for the Developer Certification and trying to understand the Sharing Model. Looks to me like Cases is the only object for which you can define Assignment and Escalation rules. Is this correct?

 

Couldn't the Assignment Rule functionality have been implemented in a Sharing Rule?

 

 

I have quite a few legacy Excel spreadsheets each of which has a large number of columns. If I have to use the Setup Menu to create objects with that many fields it will be a VERY TIME-CONSUMING process.

 

Is there no way to import an entire table schema programmatically without having to first define the schema in the Salesforce database using the Setup menu?

 

Is there nothing similar to an .sql script file like that available in MySQL that allows one to generate a schema programmatically?

 

Is there some way to directly edit meta data in Eclipse and GENERATE NEW OBJECTS in the Salesforce database?

 

Help!!

 

John (pluviosilla@gmail.com)

Newbee Question: I have some legacy Excel files with very large numbers of columns. It would be VERY TIME CONSUMING to use the Setup menu to create the schemas for the objects I want to populate with data, so I was hoping I could use either Dataloader or the Import wizard to import an object that is completely new (i.e. that does not already have a schema definition in Salesforce).

 

When I run Dataloader:

(1) Object rerquired: It insists that I specify an existing object, but

(2) Undefined fields: it appears, at first, to accept a CSV file with new columns (for which there are no predefined fields)

 

The import runs smoothly without errors, but I see nothing in the database.

 

Please tell me if what I am attempting is even possible. If not, is there a 3rd party application that does this?

 

Thanks,

John (pluviosilla@gmail.com)