-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
9Replies
New to Apex -- need help with object references
I am writing Apex triggers, and attempting to grab information from existing objects. The challenge is in trying to obtain the information.
Two questions:
1) Accounts own Opportunities. Opportunities own a custom object called Revenue__c. Revenue needs to have a lookup relationship with Account, so that the Revenue related list will appear on the Account detail page. I've written a trigger to auto-populate the Account__c lookup field on a new revenue object when the revenue object is being saved, but I'm not getting the right phrasing to grab the Acount id.
I've tried:
List<Revenue__c> existingRev= [SELECT ID, Opportunity__c, Account__c FROM Revenue__c];
list<Revenue__c> listrev = new list<Revenue__c>();
for( Revenue__c rev1 : existingRev)
{
rev1.Account__c = rev1.Opportunity__r.AccountId ;
listrev.add(rev1);
}
update listrev;
But the assignment line isn't correct. Is this how you'd reference an object through another object?
2) In trying to grab data from a Text field and save it in the Phone field of the Contact, I'm getting Null stored there instead. Do I have to do something in order to get the text info to be accepted as a phone number?
Thanks.
-
- NOTLSimpson
- August 16, 2012
- Like
- 0
- Continue reading or reply
Data concatenation
Because of an old system requirementa that isn't in place anymore, all the contact phone numbers in Salesforce are in the form
Work_Country_Code__c
Work_City_Code__c
Work_Phone_Number__c
We now want to revert to having a single phone number field. Is there any wya using LexiLoader or some other too that I can contatenate the contents of these fields, and put them into the default Salesforce Phone field?
-
- NOTLSimpson
- August 13, 2012
- Like
- 0
- Continue reading or reply
manually editing data
Hi -- I have a custom object, Rev, which is a child of Opportunities and it needs to refer back to the Account that owns the Opportunity. My concern is that there are a whole bunch of Rev components that don't have the Account info populated, and I want to find a way to say:
If Rev A belongs to Opp B, and Opp B is owned by Account C, then populate Rev A's accountID field with Account C's ID.
Does anyone have an idea of how to do this?
-
- NOTLSimpson
- August 10, 2012
- Like
- 0
- Continue reading or reply
three-level objects and info sharing
I have created a custom object under Opportunity, called Rev. When someone creates a new Opportunity and saves it, they then create a Rev object. However, while the account is auto-populated to the Opportunity, I have to ask the users to re-enter the Account info when they are creating a Rev object. This is necessary because I had to have a look-up relationship, so that the Rev objects would show up in a related list on teh Account detail page.
Is there an easy way to auto-pop the account into the Rev object?
-
- NOTLSimpson
- August 10, 2012
- Like
- 0
- Continue reading or reply
Difficulty installing Salesforce for Outlook
Has anyone has issues installing Salesforce for Outlook? I don't use Outlook, but I've set up the configuration, and had a user download the installation file and try to run it, but nothing happens. He then opens Outlook, and nothing happens -- no installation wizard, nothing. I've watched his desktop while he's doing this, and there's nothing obviously wrong. He's running Outlook 2010. Any ideas?
-
- NOTLSimpson
- May 08, 2012
- Like
- 0
- Continue reading or reply
New to Apex -- need help with object references
I am writing Apex triggers, and attempting to grab information from existing objects. The challenge is in trying to obtain the information.
Two questions:
1) Accounts own Opportunities. Opportunities own a custom object called Revenue__c. Revenue needs to have a lookup relationship with Account, so that the Revenue related list will appear on the Account detail page. I've written a trigger to auto-populate the Account__c lookup field on a new revenue object when the revenue object is being saved, but I'm not getting the right phrasing to grab the Acount id.
I've tried:
List<Revenue__c> existingRev= [SELECT ID, Opportunity__c, Account__c FROM Revenue__c];
list<Revenue__c> listrev = new list<Revenue__c>();
for( Revenue__c rev1 : existingRev)
{
rev1.Account__c = rev1.Opportunity__r.AccountId ;
listrev.add(rev1);
}
update listrev;
But the assignment line isn't correct. Is this how you'd reference an object through another object?
2) In trying to grab data from a Text field and save it in the Phone field of the Contact, I'm getting Null stored there instead. Do I have to do something in order to get the text info to be accepted as a phone number?
Thanks.
- NOTLSimpson
- August 16, 2012
- Like
- 0
- Continue reading or reply
Data concatenation
Because of an old system requirementa that isn't in place anymore, all the contact phone numbers in Salesforce are in the form
Work_Country_Code__c
Work_City_Code__c
Work_Phone_Number__c
We now want to revert to having a single phone number field. Is there any wya using LexiLoader or some other too that I can contatenate the contents of these fields, and put them into the default Salesforce Phone field?
- NOTLSimpson
- August 13, 2012
- Like
- 0
- Continue reading or reply
manually editing data
Hi -- I have a custom object, Rev, which is a child of Opportunities and it needs to refer back to the Account that owns the Opportunity. My concern is that there are a whole bunch of Rev components that don't have the Account info populated, and I want to find a way to say:
If Rev A belongs to Opp B, and Opp B is owned by Account C, then populate Rev A's accountID field with Account C's ID.
Does anyone have an idea of how to do this?
- NOTLSimpson
- August 10, 2012
- Like
- 0
- Continue reading or reply
three-level objects and info sharing
I have created a custom object under Opportunity, called Rev. When someone creates a new Opportunity and saves it, they then create a Rev object. However, while the account is auto-populated to the Opportunity, I have to ask the users to re-enter the Account info when they are creating a Rev object. This is necessary because I had to have a look-up relationship, so that the Rev objects would show up in a related list on teh Account detail page.
Is there an easy way to auto-pop the account into the Rev object?
- NOTLSimpson
- August 10, 2012
- Like
- 0
- Continue reading or reply