• StormConsulting
  • NEWBIE
  • 5 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 30
    Replies
I have an object with a datetime field. I want to select all records from this object where the datetime's month and year value, equals the current month and year.

So it might look like

SELECT Name FROM myObj__c WHERE date_time.getMonth() = currentMonth AND date_time.getYear() = currentYear

Any help is much appreciated!
How can I get the current Salesforce User ID in an Apex class?

Any help is appreciated!

Chris
Is it possible to join two custom objects in a SOQL statement?

For example I have two objects:

Message__c (Fields: Name, To__c, Originator__c, Body__c)
Originator__c (Fields: Name)

The Originator field in the Message object is a normal lookup. When I do a normal SOQL SELECT in Apex, this returns the Id.

I have tried the examples in the docs which don't seem to work, is it possible to do it with custom objects?

Basically I am trying to achieve the equivalent of this SQL:

Code:
SELECT
  Message.Name, Message.Body, Originator.Name
FROM
Message
LEFT JOIN Originator ON Message.Originator = Originator.Id

 The result set would look like:

'Message Name', 'Hi there blah blah', 'MyOriginator1'

How can I create a basic form that is not bound to an object. I just want some inputFields with a submit button, that gets processed in the custom controller class, then finally output some text on the page saying if it was successful or not.

Here's what I have
Code:
<apex:form >
 To <apex:inputField id="to" />
From <apex:inputField id="from" />
Message <apex:inputField id="message" />

<apex:commandButton value="Send" action="{!sendSMS}" />
</apex:form>

I am getting an error 'value for inputField is not a dynamic binding!'

How can this be done?

How can I create a input lookup field on a VF page? I want to use the standard Salesforce lookup.

For example a field called 'Contact' whch looks up a contact.

Thanks
I have a test class with testMethods in, all of which cover above 75%. When I deploy, it still will not complete, it is giving me this error, which is an expected validation error. If I remove the piece of test code that causes this error, then the test coverage falls below 75%!

This makes no sense to me... does there need to be no expected errors in order to deploy?

The docs say for best practice use test code that will cause expected errors!

See screenshow below...

Hi,

How can I consume an external web service using Apex code? I have seen a post here from two years ago that says it's impossible. There is a news article saying that Salesforce have implemented this functionality - http://blogs.zdnet.com/BTL/?p=5097

How can it be done?

Cheers
Nobody seems to know anything about mail merging here but I'll try anyway...

I can mail merge my booking object fine, it brings back all of the information into the document. I want to get information that's link to the booking. For example, I need the customers address. The account object is linked to the booking object via the account lookup/id. Is it possible to merge fields from the account object such as address into my document?

Cheers
Whats the syntax for mail merging a custom field, for example:

Contact_FirstName gets the first name of the contact object.

How is it done with a custom object. I have tried a number of ways like

SFDC_Special_Event__c_Name
SFDC_Special_Event__c.Name

But it always returns blank.
Hi all, I'm trying to run a simple trigger before delete. The error I'm getting is:

System.NullPointerException: Attempt to de-reference a null object


Code:
trigger deleteMultiday on SFDC_Special_Event__c (before delete) {

        for (SFDC_Special_Event__c co : Trigger.new)
        {

        }//end main for

}//end trigger

 I originally had logic in the loop but removed it to see if it was causing the error. But the error is still showing with this code. The above code works perfectly in insert/update triggers.

In Apex/Eclipse, how can I perform this simple update:

UPDATE bookings SET field1 = 'a', field2 = 'b', field3 = 'c' WHERE set_id = 999

So all I want to do is update all the records with the set_id that I specify. bookings would be my custom object.

Cheers
In Apex/Eclipse, how can I perform this simple update:

UPDATE bookings SET field1 = 'a', field2 = 'b', field3 = 'c' WHERE set_id = 999

So all I want to do is update all the records with the set_id that I specify. bookings would be my custom object.

Cheers
How can I create and call a function in an Apex class that will return a value? I have managed to create a void method that doesn't return, but I need to return a value.

Cheers
Is it possible to add a day to a Datetime variable, for example myDate contains 31/08/2008, how can I add one day to it, which will make it become 01/09/2008?

Cheers
Hi all,

I have a working trigger which I'm trying to write a testMethod for in Eclipse.

I have created a new class to put the testMethod in, but I am getting an error 'unexpected token SFDC_Special_Event__c' here is my code:

Code:
public class aTest {

    static testMethod void test_dupeBooking
 {
  SFDC_Special_Event__c myBooking = new SFDC_Special_Event__c(Name='one');
  //SFDC_Special_Event__c[] bks = new SFDC_Special_Event__c[] { bk1 };
  
  //insert bks;
 }

}

 I also get the error if I change SFDC_Special_Event__c to the standard Account object. It seems none of the objects are being recognized. What am I missing? I can see the custom object in the project treeview.

Cheers

Hi all,

I have a working trigger in our Developer Edition. I want to put this trigger on our Entrprise Edition. Do I need to get a Sandbox to do this?

I've got Eclipse setup, when I try to create a trigger in EE from Eclipse there's an error saying can't create trigger in installed package. When I try to create a sandbox project in Eclipse, it won't connect/login, I'm guessing I need to create a sandbox first in EE? How do I do this?

Cheers
Hi all,

I have a trigger created in our Development Edition, I want this to be moved into our Enterprise Edition. From what I've read one way if to use the Force.com IDE to do this.

I can run Eclipse, when I try to install the updates for the Force.com IDE, it just crashes. Anyone else had problems with this? Is there an easier way to move our trigger?

I'm running Vista Home Premium.

Cheers
Hi all,

I have the 'Event Management' app installed, which lets us manage bookings for all of our rooms. Our problem is, when adding a booking, we need a validation rule to query the Booking object and see if that room is already booked for that date.

Is it possible to check this from a validation rule? Or what other alternatives is there?

Cheers
How can I get the current Salesforce User ID in an Apex class?

Any help is appreciated!

Chris
How can I get the current Salesforce User ID in an Apex class?

Any help is appreciated!

Chris
Hey all,

I'm trying to teach myself a little bit of Apex and I'm doing it by coming up with problems and then trying to solve them. I'm trying to write a trigger that will update text fields on a parent account from a child. Basically, I've created several fields on an Opportunity called Product1, Product2, etc. I'm working on an Apex trigger that will read all line items associated with that opportunity and put them in the correct fields. I'm not overly concerned with how it looks in the field, I'm just trying to get it to work...

When I try to save, I'm getting an unexpected token error at line 7 column 37. I'm guessing this has to do with how I attempted my SOQL statement, but I've tried several variations and I keep getting the same error. Here is the code:


trigger SetOppProducts on OpportunityLineItem (after insert, after update, after delete) {
String TheProduct, OppName;
Integer TheCount = 0;

OpportunityLineItem x = trigger.new;
Opportunity o = new Opportunity (Id = x.OpportunityId);
for(OpportunityLineItem[] oli : [select Id where OpportunityId = x.OpportunityId] {

TheProduct = 'Coated: ';
TheProduct += x.Coated__c;
TheProduct += ', Felted: ';
TheProduct += x.Felted__c;
TheCount++
if (TheCount = 1) {o.Product1__c = TheProduct} {
else if (TheCount = 2) {o.Product2__c = TheProduct} {
else if (TheCount = 3) {o.Product3__c = TheProduct} {o.Product4__c = TheProduct}
}
update o;
}


Any direction as to where I'm going wrong would be much appreciated. Thanks!
  • August 06, 2008
  • Like
  • 0
Is it possible to join two custom objects in a SOQL statement?

For example I have two objects:

Message__c (Fields: Name, To__c, Originator__c, Body__c)
Originator__c (Fields: Name)

The Originator field in the Message object is a normal lookup. When I do a normal SOQL SELECT in Apex, this returns the Id.

I have tried the examples in the docs which don't seem to work, is it possible to do it with custom objects?

Basically I am trying to achieve the equivalent of this SQL:

Code:
SELECT
  Message.Name, Message.Body, Originator.Name
FROM
Message
LEFT JOIN Originator ON Message.Originator = Originator.Id

 The result set would look like:

'Message Name', 'Hi there blah blah', 'MyOriginator1'

How can I create a basic form that is not bound to an object. I just want some inputFields with a submit button, that gets processed in the custom controller class, then finally output some text on the page saying if it was successful or not.

Here's what I have
Code:
<apex:form >
 To <apex:inputField id="to" />
From <apex:inputField id="from" />
Message <apex:inputField id="message" />

<apex:commandButton value="Send" action="{!sendSMS}" />
</apex:form>

I am getting an error 'value for inputField is not a dynamic binding!'

How can this be done?

How can I create a input lookup field on a VF page? I want to use the standard Salesforce lookup.

For example a field called 'Contact' whch looks up a contact.

Thanks
Hi Everyone,

I want to ask about visualforce. Is it possible to call external web service in visualforce? any suggestions would be great.
Just for information, let's say I want to call S3 web service into visualforce.

thanx
I have a test class with testMethods in, all of which cover above 75%. When I deploy, it still will not complete, it is giving me this error, which is an expected validation error. If I remove the piece of test code that causes this error, then the test coverage falls below 75%!

This makes no sense to me... does there need to be no expected errors in order to deploy?

The docs say for best practice use test code that will cause expected errors!

See screenshow below...

Whats the syntax for mail merging a custom field, for example:

Contact_FirstName gets the first name of the contact object.

How is it done with a custom object. I have tried a number of ways like

SFDC_Special_Event__c_Name
SFDC_Special_Event__c.Name

But it always returns blank.
Hi all, I'm trying to run a simple trigger before delete. The error I'm getting is:

System.NullPointerException: Attempt to de-reference a null object


Code:
trigger deleteMultiday on SFDC_Special_Event__c (before delete) {

        for (SFDC_Special_Event__c co : Trigger.new)
        {

        }//end main for

}//end trigger

 I originally had logic in the loop but removed it to see if it was causing the error. But the error is still showing with this code. The above code works perfectly in insert/update triggers.

In Apex/Eclipse, how can I perform this simple update:

UPDATE bookings SET field1 = 'a', field2 = 'b', field3 = 'c' WHERE set_id = 999

So all I want to do is update all the records with the set_id that I specify. bookings would be my custom object.

Cheers
In Apex/Eclipse, how can I perform this simple update:

UPDATE bookings SET field1 = 'a', field2 = 'b', field3 = 'c' WHERE set_id = 999

So all I want to do is update all the records with the set_id that I specify. bookings would be my custom object.

Cheers
Is it possible to only mail merge certain opportunity product line items? For instance I only want the mail merge doc to include line items from a single product family.

Has anyone done something like this?

Thanks,

Chris

  • December 14, 2007
  • Like
  • 0