apex-code

Salesforce Apex - Populating an object from SOQL query

点点圈 提交于 2020-01-03 03:46:07
问题 I have a simple SOQL query that returns information relating to a Contact and CampaignMember. I'm attempting to populate a custom object with the results of the SOQL query. However I get the following error when loading the Visualforce page: Invalid field campaign.name for CampaignMember List campaignMembers = [select campaign.name, contact.id,contact.firstname, contact.lastname, status, campaignId from CampaignMember where contactId = '003U000000U0eNq' and campaignId in :campaigns]; for

Overriding properties from abstract class in Salesforce Apex

别来无恙 提交于 2020-01-02 06:10:55
问题 I have an abstract class in apex with several properties that I would like to override in a child class. According to the documentation, properties support both the override and virtual access modifiers. However, when I try to use either of them in either the parent or child class, I get an error saying that variables cannot be marked as virtual/override. Here is a facsimile of the code that causes this error: public abstract class Row{ public virtual double value{ get{return value==null ? 0

Overriding properties from abstract class in Salesforce Apex

淺唱寂寞╮ 提交于 2020-01-02 06:10:13
问题 I have an abstract class in apex with several properties that I would like to override in a child class. According to the documentation, properties support both the override and virtual access modifiers. However, when I try to use either of them in either the parent or child class, I get an error saying that variables cannot be marked as virtual/override. Here is a facsimile of the code that causes this error: public abstract class Row{ public virtual double value{ get{return value==null ? 0

How to convert Salesforce rich text editor to a “full mode” editor?

痞子三分冷 提交于 2020-01-01 16:58:31
问题 With the spring '12 coming over these days, the old "hack" to convert the rich editor will not work any more. What can be done to retain full CKEditor functionality after spring 12? 回答1: New CKEditor is object rather than URL based and a new approach is needed. In case anyone needs it, the following script will replace factory editor layout with a full version allowing additional formating options (fonts, colors, etc). Note, I set the height to 600px, adjust for your own needs. Also, as

How to implement “Save & New” functionality in a VisualForce Page

我与影子孤独终老i 提交于 2019-12-30 10:14:06
问题 I know that this is how to save a record <apex:commandButton action="{!save}" value="Save"/> Now I want a button to save the current record and reset the form to input another record. Something like this... <apex:commandButton action="{!SaveAndNew}" value="Save & New"/> 回答1: The URL for the new record page is the {org URL}/{3 letter object prefix}/e?". You could define your save method as follows, where m_sc is a reference to the standardController passed to your extension in it's constructor

Is there any option to connect other db in the salesforce platform? [closed]

只愿长相守 提交于 2019-12-25 08:23:26
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I would like to know whether there any option to connect to the external db in the salesforce platform. Thanks, Easwar 回答1: You cannot use an external database for your Salesforce data, if that's what you're

How to populate lookup field when creating a new custom object in SFDC

拈花ヽ惹草 提交于 2019-12-25 05:27:18
问题 I'm struggling with this situation.. I have a Standard Object in SFDC (Opportunity) that has a custom look up field pointing to the User object what I'm trying to do is populate this field with the name of the user that creates a custom object that is available in the Opportunity layout... i.e. New GOP Checklist --- Then choose the type of checklist--- and then fill all the required fields and click save, this is pointing back to the Opportunity view. To start with is this something doable ?

make a select object field in salsforce

笑着哭i 提交于 2019-12-25 02:02:32
问题 First, I'm just a beginner in salesforce and started to learn visualforce page using apex, basically I have the default object "people", and many records in it now is to write a "payment" visual page to allow people to select the people record they are master-details relationship, what apex tag should I use in both page side and apex class? similar like time selector one below: page code: <apex:inputField value="{!proxyObject.closeDate}"/> class: opportunity o = new Opportunity(); public

Connecting Unrelated Objects during Apex Trigger

走远了吗. 提交于 2019-12-24 19:33:21
问题 I am trying to create a trigger that does the following: Once an Account has been created, create an unrelated record (called a "Portal Content" record) that bears the same name, assuming the default RecordTypeId Take the ID of the newly created "Portal Content" record, and insert it into a lookup field on the originally created Account Add the ID of the original Account, and enter it into a field of the newly created "Portal Content" record Steps 1 and 2 were addressed in post Populate

Basic XML parsing issues. Cannot find node names via Java XmlStreamReader method. Any ideas?

自古美人都是妖i 提交于 2019-12-24 13:58:03
问题 Having no luck in parsing some basic XML. I'm doing this in the Apex language, but it's syntactically nearly identical to Java and in this case uses java.xml.stream.XMLStreamReader as its XML parsing engine. The problem is: I'm having no luck getting to any of the actual XML node names. The getLocalName() method within the XmlStreamReader class always returns null for all nodes as I loop through them. code is here Very basic functionality at this point. If you run this, you will see that