• dev_force
  • NEWBIE
  • 160 Points
  • Member since 2009

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 35
    Replies

I am trying to design a visualforce page tha creates Account, Contact, and Opportunity records. I also am needing to send values to a custom object. The problem is that I cannot find the correct syntax to pull the field from the custom object.

 

for example

Standard is {!Opportunity.Name}

Custom is ???

 

I have read about the term "MyCustomObject__c" but cannot get it to work.

 

Can anyone help?

 

 

I am having a problem with the following code. My problem is that some of the fields are able to be edited and saved and some are not. My goal here is just  have a VFpage where the uses can edit these records and save them using the My Save button. 

 

But if I change the fields and try to save, some of them save and some of them don't. Am I doing something wrong?

 

Controller code:

 

public class RasmussenEnrollmentClass_Ver3 { // Declare standardController controller private ApexPages.StandardController controller; private EA__c enrollment; // Will help us determine whether to do Insert or Update upon Save private Boolean bUpdate; public RasmussenEnrollmentClass_Ver3(ApexPages.StandardController stdController) { this.controller = stdController; this.enrollment= (EA__c)stdController.getRecord(); //if the pos.id is null that means this is an insert of a new obj, not and edit bUpdate = enrollment.id == null ? false : true; } public PageReference myEA() { if ([select Id FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()].size() > 0) { EA__c eaID= [select Id FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()]; PageReference pg= new PageReference('/apex/RasEA_1?id='+eaId.Id); pg.setRedirect(true); return pg; } else { //If size is 0 it means there is no Enrollment Agreement record. The admin assistant did not make one yet. //In this case, redirect the user to a page which says to please wait while their EA is processed PageReference pg1= new PageReference('/apex/NoEnrollment'); pg1.setRedirect(true); return pg1; //This was just a test for trying to let the student do a blank form if the EA was not created by the Admin yet //The following should not be used // PageReference pg= new PageReference('/apex/RasmussenEnrollmentPage_Fix?id='+eaId.Id); /// PageReference pg= new PageReference('/apex/RasEA_1'); // pg.setRedirect(true); // return pg; } } public PageReference mySave(){ // This is contrived unless there is something to do special in the update or insert you're trying to do // if you're not doing anything special in the save then just use the standardController.save() // if (bUpdate){ try { update enrollment; } catch(System.DMLException e) { ApexPages.addMessages(e); System.debug(e); return null; } return null; } }

 

 VF Page

 

<apex:page sidebar="false" showHeader="false" standardController="EA__c" extensions="RasmussenEnrollmentClass_Ver3"> <apex:form id="theForm"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="My Save" action="{!mySave}"/> <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inputField id="FirstName" value="{!EA__c.First_Legal_Name__c}" required="FALSE"/> <apex:inputField id="LastName" value="{!EA__c.Last_Legal_Name__c}" required="FALSE"/> <apex:inputField id="SSN" value="{!EA__c.Social_Security_Number__c}" required="FALSE"/> <apex:inputField id="DOB" value="{!EA__c.Date_of_Birth__c}" required="FALSE"/> <apex:inputField id="Phone" value="{! EA__c.Phone_Number__c}" required="FALSE"/> <apex:inputField id="Phone2" value="{! EA__c.Secondary_Phone__c}" required="FALSE"/> <apex:inputField id="Address1" value="{! EA__c.Address_1__c}" required="FALSE"/> <apex:inputField id="Address2" value="{! EA__c.Address_2__c}" required="FALSE"/> <apex:inputField id="City" value="{! EA__c.City__c}" required="FALSE"/> <apex:inputField id="Country" value="{! EA__c.Country__c}" required="FALSE"/> <apex:inputField id="Email" value="{! EA__c.Email__c}" required="FALSE"/> <apex:inputField id="Maiden" value="{! EA__c.Maiden_Name__c}" required="FALSE"/> <apex:inputField id="Phone3" value="{! EA__c.Phone__c}" required="FALSE"/> <apex:inputField id="State" value="{! EA__c.State__c}" required="FALSE"/> <apex:inputField id="Zip" value="{!EA__c.Zipcode__c}" required="FALSE"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

Hi,

 

Would like to ask how to set a field to readonly immediately when a checkbox is checked on standard object Edit page.

 

Can this be done by using VisualForce?

 

Thanks.

  • March 26, 2009
  • Like
  • 0

Hi,

    Can any one please tell me how to store the input data supplied through text fileds of a Visualforce page into the salesforce databse...

 

Any suggestions are welcome...

 

Thanks in adv,

-Nath

 

Hi All,

 

Trying to create a validation rule for tasks.

 

I have a picklist field called Type that has multiple values and another field called Name that is a lookup for accounts. 

 

The rules is for users when they select Type picklist value "Sales Meeting Call", Name has to be filled with a lookup.

 

But when I'm creating the rule, in the Insert Field option the lookup field is not visible?

 

Thanks,

Richard 

Hi,

I would like to ask if any expert know how to develop the Lookup button in the Visualforce Page. Thanks!

Best regards

 

  • February 26, 2009
  • Like
  • 0
Why is there no "Flex / Air" developer board category ?

Are there any functions that can be used in validation rules or apex triggers/classes that can be used to compare two roles and return whether one is higher in the role hierarchy than the other?

 

 

Thanks.

Is it safe to use:

 

SELECT Id, Name FROM Account WHERE Name < 'a' ?

 

 

It seems to work... and returns accounts with names like:

$123abc

84888

20-20 Inc

 

Is it possible for more than one of these variables to be true within a single invocation of a trigger?

 

Trigger.isInsert

Trigger.isUpdate

Trigger.isDelete

Trigger.isUndelete

 

I have 2 fields within a pageBlockSection.

 

The fields are not visible to the user using field level security.

 

When the visualforce page is rendered the title of the pageBlockSection is shown. Shouldn't the title of the pageBlockSection be hidden if the fields within it are not visible?

 

 

note:this page is shared by different users, some have access to the field, some do not

 

Why is it that "Total number of records retrieved by SOQL queries" is:

10,000 - anonymous block, visualforce controller or WSDL method

BUT

500 for RunTests 

 ?

 

My code can handle more than 10,000 rows, but my test class fails because tests can only operate within the 500 limit.  Even though my test class does not create more than 500 records, the test class/method seems to operate on the data in the actual org plus the data created in the test class/method.

 

 

Please advise.

Are there any reasons why Custom Labels can't be used as configuration paramters in apex classes/triggers?

 

 

For example,

 

String queryFields = System.Label.CustomQueryFieldsAccount;

 

List<Account> = Database.query("SELECT "+queryFields+"FROM Account);

Message Edited by dev_force on 03-27-2009 12:13 PM

I'm sending an email to a contact which I expect to fail (the contact has NO email address specified):

 

 

 

List<Messaging.SingleEmailMessage> emailList = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage sem = new Messaging.SingleEmailMessage();
sem.setSubject('test subject');
sem.setHtmlBody('testbody');
sem.setSaveAsActivity(false);
sem.setTargetObjectId('003R00000090cra');

emailList.add(sem);


List<Messaging.SendEmailResult> sendEmailResult = Messaging.sendEmail(emailList, false);
System.Debug('@@@@ '+sendEmailResult);

 

 Here is the result that comes back:

 

13:08:57 INFO  - 20090325170853.851:AnonymousBlock: line 13, column 1: @@@@ (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;])

 

Why is the SendEmailError object not being fully populated?

 

I would expect the following to be populated:

- getMessage

- getStatusCode

- getTargetObjectId

 

 

Message Edited by dev_force on 03-25-2009 10:13 AM
Message Edited by dev_force on 03-25-2009 10:42 AM
Message Edited by dev_force on 03-25-2009 12:58 PM

The main visualforce page looks something like:

 

<apex:page id="mainPage" tabStyle="Custom_Visualforce__tab" controller="SomeCustomController">

-- some content --

<apex:outputPanel layout="block" id="detail">
<apex:iframe src="{!someUrl}" scrolling="false" height="500px" width="100%" />
</apex:outputPanel>

</apex:page>

 

 

 

"someUrl" points to the following visualforce page:

<apex:page standardController="Document" standardStylesheets="true" tabStyle="Custom_Visualforce__tab" extensions="SomeDifferentCustomController" showHeader="false" sidebar="false" >

-- some content --

</apex:page>

 

 

The main visualforce page appears styled according to the Custom_Visualforce__tab style.  However, the visualforce page style in the iFrame appears all black.

 

 

Is it possible to style a VF page in an iframe so that it follows a custom tab style?

Here is the scenario:

- Page has an InputTextarea with richText="true" specified

- An action function is used to promt the user and submit the page

- When the actionFunction reRender property is set, the content from the inputTextarea is NOT passed to the controller

- When the actionFunction reRender property is NOT set, the content from the inputTextarea IS passed to the controller

- Using a normal command button, the value is ALWAYS passed to the controller

 - If the InputTextarea richText="false", using the actionFunction or command button BOTH submit the content to the controller without issue. 


After hitting either button, the results can be seen in the "System Log" window

 

 

Any ideas?

 

 

 

visualforce page

 

<apex:page controller="TestRichTextAreaController">

<script language="javascript">
function confirmAction()
{
var answer = confirm("Proceed?");
if (answer)
{
//call actionFunction
proceedWithSave();
}
else
{
alert('nto done');
}
}
</script>

<apex:Form id="mainForm">

<apex:actionFunction action="{!doSave}" name="proceedWithSave" rerender="testSection"/>


<apex:pageBlock title="Test Input Text Area - Rich Text" mode="edit">

<apex:pageBlockButtons >
<input id="confirmButton" type="button" OnClick="confirmAction();" name="confirmButton" value="Save via action function" class="btn" />
<apex:commandButton action="{!doSave}" value="Save via button"/>
</apex:pageBlockButtons>

<apex:pageBlockSection columns="1" id="contentSection" title="Content">

<apex:pageBlockSectionItem >
<apex:outputLabel value="Content" for="contentInput"/>
<apex:inputTextarea id="contentInput" value="{!content}" richText="true" rows="10" cols="100" />
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem id="testSection">
<apex:outputLabel value="Content" for="contentInput"/>
<apex:outputLabel value="Content" for="contentInput"/>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>

</apex:pageBlock>
</apex:Form>

</apex:page>

 

 

 

controller

 

public class TestRichTextAreaController {

public String content{get;set;}

public TestRichTextAreaController()
{
this.content='';

}

public void doSave()
{
System.Debug('$$ content: '+content);

}
}

 

 


 

Message Edited by dev_force on 03-23-2009 09:33 AM

Should an <apex : iframe> be re-rendered if its ID is specified in the reRender property of an actionFunction?

 

It does not seem to be working for me.

 

 

Thanks

It appears that when setting richText="false", the cols and rows properties are applied to the component.

 

<apex:inputTextarea rows="10" cols="100" value="{!content}" id="content" richText="false"/>

 

However, when using richText="true" the cols and rows properteis have no effect on the component.

 

<apex:inputTextarea rows="10" cols="100" value="{!content}" id="content" richText="true"/>

 

 

 

Anyone else experience this?

Here is the scenario:

 

- I have a custom object called Car

- The default organization security on the Car object is 'Private'

> When a user tries to edit a Car record that has been manually shared with him/her as read-only, salesforce displays the "insufficient access" page

 

 

- After I override the 'Edit' button on the Car object with a visualforce page

> When a user tries to edit a Car record that has been manually shared with him/her as read-only, salesforce displays the Edit screen

 

 

QUESTION: Shouldn't salesforce always display the "insufficent access" screen?

Message Edited by dev_force on 03-17-2009 01:41 PM

Anyone know why $Component is useful?

 

For example, what is really the difference between  

onclick="alert('{!$Component.theSection.theSectionItem}');

 

and

onclick="alert('detailPage:mainForm:pageBlock:hiddenField');

 

 

... there doesn't seem to be any validation on the $Component  tag.

I use the following link for a custom button: /apex/apexPage?type={!$ObjectType.Account}

 

Which is essentially equivalent to: /apex/apexPage?type=001

 

 

In my visualforce controller i'd like to compare "001" without hard coding a value.  For example, using: "Account.sObjectType" results in "Account" NOT "001".

 

Is there anything equalivent to "$ObjectType.Account" in Apex ? 

 

 

Thanks

The documentation has the example

<apex:page standardController="Document" extensions="documentExt"> <-- Upload a file and put it in your personal documents folder--> <apex:messages /> <apex:form id="theForm"> <apex:pageBlock> <apex:pageBlockSection> <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

Is it possible to use the inputFile tag with another controller? For example:

 

 

<apex:page standardController="Some_Custom_Object__c" extensions="documentExt"> <-- Upload a file and put it in your personal documents folder--> <apex:messages /> <apex:form id="theForm"> <apex:pageBlock> <apex:pageBlockSection> <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

Thanks.

Hi, I have created a simple multi line editor. My business requirement is that I have to add every edited row (item) as a new item in the database. On save event, I get the new items from the screen and in another similar object, I fetch older items from DB and then compare them using a loop. If any row (item) is different, found updated, I insert that into DB. I have wrote the following code (simplified) to achieve this functionality. Unfortunately it gives me the following exception. Would somebody please suggest me some solution to this problem. Thanks,

Shakespeare

 

Code:

<apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" reRender="pixelReqTable"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> <apex:column headerValue="Advertiser"> <apex:inputField value="{!aPixelReq.Advertiser__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

======================================================= public class PixelReqFormController { List<PixelReqForm__c> pixelReqList; public List<PixelReqForm__c> getPixelReq () { return pixelReqList; } public PageReference save() { string contractID = ApexPages.currentPage().getParameters().get('contractID'); //Call to comparer method. If some item is found to be updated, only that item(s) will be

// returned and will be inserted into db as new records. pixelReqList = comparePixReqObjs (pixelReqList); if (pixelReqList != null && pixelReqList.size() > 0) { insert pixelReqList; } else { ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.INFO, 'There were no changes to save.'); ApexPages.addMessage(myMsg); } return null; } public List<PixelReqForm__c> comparePixReqObjs (List<PixelReqForm__c> newList) { List<PixelReqForm__c> updateableList = new List<PixelReqForm__c>(); List<PixelReqForm__c> oldList; PixelReqForm__c pixelReqObj; //getting older pixel list from DB oldList = [SELECT isDeleted__c, Agency__c, Advertiser__C, BCN__c, Value__C, Web_Page_Name__c, Web_Page_URL__c, OAS_System__c, Pixel_Usage__c, Tag_Security__c, Tag_Type__c, Special_Requests__c, ContracID__c FROM PixelReqForm__c where ContracID__c = :ApexPages.currentPage().getParameters().get('contractID') AND isDeleted__c = false order by agency__c desc]; //Comparing older and newer list for differences. If used has updated something, it will be

//saved as a new record. Otherwise no save operation will be done.

for (Integer i=0; i<oldList.size(); i++) { if (newList[i].Agency__c != oldList[i].Agency__c) { //initializing the object with new values, giving me the subject error. pixelReqObj = new PixelReqForm__c (Agency__c = newList[i].Agency__c,

Advertiser__c = newList[i].Advertiser__c); updateableList.add(pixelReqObj); } } return updateableList; } }

 

 
Is there an equivalent of  $Api.Enterprise_Server_URL_111 in an Apex Class? To get the session Id, I need UserInfo.getsessionid(), but is the only way to get the URL by setting it as a formula field somewhere and retrieve it? I can't see any other way...

Is it safe to use:

 

SELECT Id, Name FROM Account WHERE Name < 'a' ?

 

 

It seems to work... and returns accounts with names like:

$123abc

84888

20-20 Inc

 

I have several triggers on the opportunity object...before insert, before update and before insert, before update.  I need to add a new trigger that fires after the opportunity is updated:

 

trigger OpportuntityAfterUpdate on Opportunity (after update) { List<Opportunity> opps = [Select Id, Transaction_ID__c, Name, StageName, Product_Line_ProDev_Category__c, Opportunity.Account.BillingStreet, Opportunity.Account.BillingCity, Opportunity.Account.BillingState, Opportunity.Account.BillingPostalCode From Opportunity WHERE Id in :Trigger.new]; Set<Id> oppyIds = new Set<Id>(); for (Opportunity o : opps) { oppyIds.add(o.Id); } OpportunityLineItem oli = [Select Site__c From OpportunityLineItem WHERE OpportunityId in : oppyIds LIMIT 1]; if (oli.Site__c <> null) { Account acct = [Select a.Name, a.Id From Account a WHERE a.Id = : oli.Site__c]; for (Opportunity oppy: opps) { if (oppy.StageName == 'Closed Won' && oppy.Product_Line_ProDev_Category__c > 0) { // Create a new single email message object // that will send out a single email to the addresses in the To, CC & BCC list. Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); // Strings to hold the email addresses to which you are sending the email. String[] toAddresses = new String[] {'test@test.com'}; String[] ccAddresses = new String[] {'test@test.com.com',}; // Assign the addresses for the To and CC lists to the mail object. mail.setToAddresses(toAddresses); mail.setCcAddresses(ccAddresses); // Specify the address used when the recipients reply to the email. mail.setReplyTo('test@test.com'); // Specify the name used as the display name. mail.setSenderDisplayName('Salesforce Support'); // Specify the subject line for your email address. mail.setSubject('A new Professional Development order has been placed!'); // Set to True if you want to BCC yourself on the email. mail.setBccSender(false); // Optionally append the salesforce.com email signature to the email. // The email address of the user executing the Apex Code will be used. mail.setUseSignature(false); // Specify the text content of the email. mail.setPlainTextBody('Opportunity Name: ' + oppy.Name + '/n' + 'Transaction ID: ' + oppy.Transaction_ID__c + '/n' + 'Account Name: ' + acct.Name + '/n' + 'Billing Address: ' + oppy.Account.BillingStreet + '/n' + 'Billing City: ' + oppy.Account.BillingCity + '/n' + 'Billing State: ' + oppy.Account.BillingState + '/n' + 'Billing Zip: ' + oppy.Account.BillingPostalCode + '/n'); mail.setHtmlBody('<p>Opportunity Name: ' + oppy.Name + '</p>' + '<p>Transaction ID: ' + oppy.Transaction_ID__c + '</p>' + '<p>Account Name: <a href=https://cs2.salesforce.com/' + acct.Id + '>' + acct.Name + '</a></p>' + '<p><hr /></p>' + '<p>Billing Address: ' + oppy.Account.BillingStreet + '</p>' + '<p>Billing State: ' + oppy.Account.BillingState + '</p>' + '<p>Billing Zip: ' + oppy.Account.BillingPostalCode + '</p>'); // Send the email you have created. Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } } } }

 

The above trigger works by itself, but it is conflicting with the other triggers on the opportunity object.  It is causing the error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY error when a new opportunity is created. 

 

Here are the three existing triggers on the opportunity that are conflicting with the after update trigger:

 

trigger OpportunityBeforeInsert on Opportunity (before insert) { // calculate the "active *" fields on this opportunity's accounts for (Opportunity oppy : Trigger.new) { AccountActivityCalculator.updateAccount(oppy.AccountId); } } trigger OpportunityBeforeInsertBeforeUpdate on Opportunity (before insert, before update) { // grab owner's ID and push it into Commission_Salesperson__c (since Owner fields are not available in formula lookups) for (Opportunity opp : Trigger.new) { if(opp.Commission_Salesperson__c == null) { opp.Commission_Salesperson__c = opp.OwnerId; } } } trigger OpportunityAfterInsert on Opportunity (after insert) { List<Opportunity> opps = [select Id, Invoice_Preference__c, Account.Invoice_Preference_Value__c, Account.Sales_Area__c, Account.FOB_Destination__c, Account.District_Active_Sites__c, Account.District_Active_Subscriptions__c from Opportunity where Id in :Trigger.new]; for (Opportunity oppy: opps) { // copy over fields from account that should be historically accurate (i.e. can't be done via formulas) oppy.Invoice_Preference__c = oppy.Account.Invoice_Preference_Value__c; if (oppy.Payment_Terms__c == '') { // user is a salesperson, did not enter it; copy from Account oppy.Payment_Terms__c = oppy.Account.Payment_Terms__c; } oppy.FOB_Destination__c = oppy.Account.FOB_Destination__c; oppy.Sales_Area__c = oppy.Account.Sales_Area__c; oppy.Active_Sites__c = oppy.Account.District_Active_Sites__c; oppy.Active_Subscriptions__c = oppy.Account.District_Active_Subscriptions__c; } update opps; }

 

How can I get around this conflict and fire the after update trigger successfully?
Message Edited by Dman100 on 04-21-2009 09:51 AM
I have a Cronkit job scheduled to run every night, and it has been doing fine for weeks, but last night 4 of the scheduled jobs did not run, and gives a message :

FutureRequests Request Limit exceeded.

 

What does this mean?

  • April 21, 2009
  • Like
  • 0

I am trying to design a visualforce page tha creates Account, Contact, and Opportunity records. I also am needing to send values to a custom object. The problem is that I cannot find the correct syntax to pull the field from the custom object.

 

for example

Standard is {!Opportunity.Name}

Custom is ???

 

I have read about the term "MyCustomObject__c" but cannot get it to work.

 

Can anyone help?

 

 

I have a created a VF Page that supposed to replace the activity history section in the contact page layout related list. Although I can see it in the page layout, it won't let me add it to the related list section.

 

public class ActivityController {
    private final Contact cont;

    public ActivityController (ApexPages.StandardController stdController) {
        this.cont = (Contact)stdController.getRecord();
}

    public PageReference newTaskforCall()
    {
        PageReference NewTaskPage = new PageReference('/00T/e?title=Call&who.id=' + System.currentPageReference().getParameters().get('id') + '&followup=1&tsk5=Call&retURL=%2F003R000000ArDZn');
        NewTaskPage.setRedirect(true);
        return NewTaskPage;
    }


    public String hasNext { get; set; }

    public PageReference next()
    {
        return null;
    }


    public String getHasPrevious()
    {
        return null;
    }


    public PageReference previous()
    {
        return null;
    }

        Public Task[] getActivities()
        {
                return [Select id, subject, what.name,activitydate, owner.name, lastmodifieddate from Task where whoid = :System.currentPageReference().getParameters().get('id') and calldurationinseconds > 0];
        }

        public Contact getContact()
        {
                return [Select id, name
                        from Contact where id = :System.currentPageReference().getParameters().get('id')];


        }
}

 

 

 

 

 

 

 

   

<apex:page standardController="Contact" extensions="ActivityController" tabstyle="Contact" sidebar="false">

  <apex:form id="myform">

    <apex:pageBlock title="Cal History" >

    <apex:pageblockButtons >

    <apex:commandButton value="Log Call" action="{!newTaskforCall}">

    </apex:commandButton>

    </apex:pageblockButtons>

    <apex:pageBlockSection title="" columns="5" collapsible="true">

    <apex:panelGrid columns="2" id="navigation">

    </apex:panelGrid>

    <apex:dataTable value="{!Activities}" var="each" border="0" styleClass="list">

        <apex:column headerValue="Subject"><a href="/{!each.id}">{!each.subject}</a></apex:column>

        <apex:column headerValue="Related To"><a href="/{!each.what.Name}">{!each.what.Name}</a></apex:column>

         <apex:column headerValue="CSD"><a href="/{!each.owner.id}">{!each.owner.Name}</a></apex:column>

        <apex:column headerValue="Due Date">{!each.ActivityDate}</apex:column>

        <apex:column headerValue="Last Modified Date/Time">{!each.lastmodifieddate}</apex:column>

    </apex:dataTable>

    </apex:pageBlockSection>

    </apex:pageBlock>

  </apex:form>

</apex:page>

I am having a problem with the following code. My problem is that some of the fields are able to be edited and saved and some are not. My goal here is just  have a VFpage where the uses can edit these records and save them using the My Save button. 

 

But if I change the fields and try to save, some of them save and some of them don't. Am I doing something wrong?

 

Controller code:

 

public class RasmussenEnrollmentClass_Ver3 { // Declare standardController controller private ApexPages.StandardController controller; private EA__c enrollment; // Will help us determine whether to do Insert or Update upon Save private Boolean bUpdate; public RasmussenEnrollmentClass_Ver3(ApexPages.StandardController stdController) { this.controller = stdController; this.enrollment= (EA__c)stdController.getRecord(); //if the pos.id is null that means this is an insert of a new obj, not and edit bUpdate = enrollment.id == null ? false : true; } public PageReference myEA() { if ([select Id FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()].size() > 0) { EA__c eaID= [select Id FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()]; PageReference pg= new PageReference('/apex/RasEA_1?id='+eaId.Id); pg.setRedirect(true); return pg; } else { //If size is 0 it means there is no Enrollment Agreement record. The admin assistant did not make one yet. //In this case, redirect the user to a page which says to please wait while their EA is processed PageReference pg1= new PageReference('/apex/NoEnrollment'); pg1.setRedirect(true); return pg1; //This was just a test for trying to let the student do a blank form if the EA was not created by the Admin yet //The following should not be used // PageReference pg= new PageReference('/apex/RasmussenEnrollmentPage_Fix?id='+eaId.Id); /// PageReference pg= new PageReference('/apex/RasEA_1'); // pg.setRedirect(true); // return pg; } } public PageReference mySave(){ // This is contrived unless there is something to do special in the update or insert you're trying to do // if you're not doing anything special in the save then just use the standardController.save() // if (bUpdate){ try { update enrollment; } catch(System.DMLException e) { ApexPages.addMessages(e); System.debug(e); return null; } return null; } }

 

 VF Page

 

<apex:page sidebar="false" showHeader="false" standardController="EA__c" extensions="RasmussenEnrollmentClass_Ver3"> <apex:form id="theForm"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="My Save" action="{!mySave}"/> <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inputField id="FirstName" value="{!EA__c.First_Legal_Name__c}" required="FALSE"/> <apex:inputField id="LastName" value="{!EA__c.Last_Legal_Name__c}" required="FALSE"/> <apex:inputField id="SSN" value="{!EA__c.Social_Security_Number__c}" required="FALSE"/> <apex:inputField id="DOB" value="{!EA__c.Date_of_Birth__c}" required="FALSE"/> <apex:inputField id="Phone" value="{! EA__c.Phone_Number__c}" required="FALSE"/> <apex:inputField id="Phone2" value="{! EA__c.Secondary_Phone__c}" required="FALSE"/> <apex:inputField id="Address1" value="{! EA__c.Address_1__c}" required="FALSE"/> <apex:inputField id="Address2" value="{! EA__c.Address_2__c}" required="FALSE"/> <apex:inputField id="City" value="{! EA__c.City__c}" required="FALSE"/> <apex:inputField id="Country" value="{! EA__c.Country__c}" required="FALSE"/> <apex:inputField id="Email" value="{! EA__c.Email__c}" required="FALSE"/> <apex:inputField id="Maiden" value="{! EA__c.Maiden_Name__c}" required="FALSE"/> <apex:inputField id="Phone3" value="{! EA__c.Phone__c}" required="FALSE"/> <apex:inputField id="State" value="{! EA__c.State__c}" required="FALSE"/> <apex:inputField id="Zip" value="{!EA__c.Zipcode__c}" required="FALSE"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

Hi all,

 

I have a problem with @future annotations. I need to do to different call outs when a new Lead is created, the first call out is to a webservice(webservice1) that returns a parameter needed for the callout to the webservice. I know that Future method cannot be called from a future method... what is the best solution to handle this?

 

Thanks

  • March 26, 2009
  • Like
  • 0

Hi,

 

Would like to ask how to set a field to readonly immediately when a checkbox is checked on standard object Edit page.

 

Can this be done by using VisualForce?

 

Thanks.

  • March 26, 2009
  • Like
  • 0

I would like to query the possible values for a picklist to put up a mutli-select field on my page.  Is there a way to query for the possible values for a simple picklist?

 

Also, I'd like to do the same for a multi-select picklist.  I know this was asked before and it wasn't possible in the past.  Is there any way to do it now?

 

I have a pipeline field that is calculated.  I would like it so when I save an opportunity, it automatically updates the amount field w/ the pipeline field.

 

Is this possible w/o having to create another button?

 

I only have SalesForce Pro.

 

Thanks.

I'm sending an email to a contact which I expect to fail (the contact has NO email address specified):

 

 

 

List<Messaging.SingleEmailMessage> emailList = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage sem = new Messaging.SingleEmailMessage();
sem.setSubject('test subject');
sem.setHtmlBody('testbody');
sem.setSaveAsActivity(false);
sem.setTargetObjectId('003R00000090cra');

emailList.add(sem);


List<Messaging.SendEmailResult> sendEmailResult = Messaging.sendEmail(emailList, false);
System.Debug('@@@@ '+sendEmailResult);

 

 Here is the result that comes back:

 

13:08:57 INFO  - 20090325170853.851:AnonymousBlock: line 13, column 1: @@@@ (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;])

 

Why is the SendEmailError object not being fully populated?

 

I would expect the following to be populated:

- getMessage

- getStatusCode

- getTargetObjectId

 

 

Message Edited by dev_force on 03-25-2009 10:13 AM
Message Edited by dev_force on 03-25-2009 10:42 AM
Message Edited by dev_force on 03-25-2009 12:58 PM

When I login,the mail give me the message:  

 

Apex script unhandled exception by user/organization: 00580000001orUz/00D80000000artE

Visualforce 页面: /apex/Start_Here

System.ListException: List index out of bounds: 0

Class.startHereController.getBannerURL: line 59, column 69
External entry point

Debug Log:

***正在开始 /apex/Start_Here 的页面日志

 

How can I cope with it?

Hi,

 

Can anyone tell what is the organization wide SOQL limit per day?

 

Regards,

Hi,

We all know inline Editable fields from the native VF interface. by this I mean a field that looks like "apex: outputfield" but when double clicked, becomes an "apex:inputfield".

I would like to know if there is any way that I could to this myself
(I have a VF page that works on multiple rows of data, using a datatable full of "apex:inputfield" components.

Is there a VF component for that? if not, is there an Idea to create one?

Thanks
  • January 03, 2009
  • Like
  • 0