• SFDCU$er
  • NEWBIE
  • 20 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 1
    Replies
I have a visualforce page with input text  Student Name and an Add Button. When I enter a value and click Add It should add the name in the table below along with the created date and Student number which would be an auto-number field.

So far this is what I have done:

Wrapper Class:
public with Sharing class WrapperClass{
public class StudentRosterData{
public Date DateCreated { get; set; }
public String Name { get; set; }
public Integer StudentNumber { get; set; }

}
public StudentRosterData studentData{get; set;}

public WrapperClass(){
studentData = new StudentRosterData();

}
}


Visualforce Page:
<apex:page controller="StudentRosterController">
    <apex:form >
Student Name: <apex:inputText value="{!Names}" />
<apex:commandButton value="Add" action="{!AddNames}"/>
<table border="0">

<tr>
     <td><b>Name</b></td>
     <td><b> Entered Date</b> </td>
    </tr>
<apex:repeat value="{!wrapper.studentData}" var="stu">
<tr>
    <td> <apex:outputText value="{!stu.Name}"/></td>
    <td> <apex:outputText value="{!stu.StudentNumber}"/></td>
    <td> <apex:outputText value="{!stu.DateCreated}"/></td></tr>
</apex:repeat>
</table>
    </apex:form>
</apex:page>


StudentRosterController:

  
public class StudentRosterController{

        public String Names { get; set; }


        public WrapperClass wrapper{get; set;}

        public pageReference AddNames() {
        WrapperClass.StudentRosterData addstudent = new WrapperClass.StudentRosterData();

           wrapper.studentData.Name = Names;
           wrapper.studentData.DateCreated = Date.today();  
           

           return null;
        }


}


Please help.
I am trying to integrate a 3rd party web app with my customer portal. There are 5 tabs on my customer portal out of which 2 of them references visualforce pages and the remaining 3 should reference 3 different pages in the web app. The integration need to be done in such a way that when a user click on any one of the 3 tabs which references the web app it should take the user to the individual web app pages associated with the tab.

E.g. If we have tab1, tab2, tab3, tab4 and tab5, tab1 and tab3 will take you to the respective visualforce pages associated with the tab. tab2 should take you to tab2 page on the web app Similarly, tab4 and tab5 should take me to tab4 and tab5 page on the webapp.

It should be a seamless integration and the user should not be aware of the fact that he is accessing 2 different apps. Would really appreciate if anyone could suggest me the best way to implement this.
I am trying to integrate a 3rd party web app with my customer portal. There are 5 tabs on my customer portal out of which 2 of them references visualforce pages and the remaining 3 should reference 3 different pages in the web app. The integration need to be done in such a way that when a user click on any one of the 3 tabs which references the web app it should take the user to the individual web app pages associated with the tab.

E.g. If we have tab1, tab2, tab3, tab4 and tab5, tab1 and tab3 will take you to the respective visualforce pages associated with the tab. tab2 should take you to tab2 page on the web app Similarly, tab4 and tab5 should take me to tab4 and tab5 page on the webapp.

It should be a seamless integration and the user should not be aware of the fact that he is accessing 2 different apps. Would really appreciate if anyone could suggest me the best way to implement this.
I want to create a custom "Create/View comment" Page where the user can create new comment as well as view all his previous comments.

ViewComment Page:


     <apex:dataTable value="{!commentdata}" var="comments">     
             
              <apex:column headerValue="Title">
                <apex:inputText value="{!title}"/>
              </apex:column>
             
     <apex:column headerValue="Comment Section">
              <apex:inputText value="{!Comment}"/>
               
              </apex:column>
              <apex:column headerValue="CreatedBy">
              <apex:inputText value="{!CreatedBy}"/>
              </apex:column>
              </apex:dataTable>
    
     <apex:column headerValue="Timestamp">
                <apex:inputText value="{!timestamp}"/>
              </apex:column>
          <apex:commandButton value="New comment" onclick="PopUp(); return false"/> //when the user clicks on this button it would open up a pop up where the user can enter the comment and click save

CretaeComment Page :

    <apex:inputTextarea value="{!Comment}"/>
    <apex:commandbutton value="Save" action="{!savecomment}"/>

When the user clicks on the save button it should update the view comment datatable on the ViewComment page and the new comment will always be on top.

how do I save value from one page to another? Here the comments are not getting stored on any salesforce custom/standard objects. It is temporarily saved on the view state. I want to save it in such a way that the recent comment should be at the top.  Any help would be appreciated.
I have used this blog post as a reference to create a custom look up visualforce page http://bobbuzzard.blogspot.com/2010/09/visualforce-lookup.html Now I have a requirement which says that I have to populate another field based on the selected look up value.

In the above mentioned blog, using the look up text field Account Name is getting populated. Now based on the selected look up value I also want another field Account Number to be auto populated. Any help would be appreciated.

I have created an opportunity trigger to send out an email to two separate email address field whenever the stage is Closed Won depending on the Campaign Type. It works perfectly fine but recently when I tried updating a list of 200 opportunity records it gave me an error saying "**Too many code statements 200001**".

 

My code is as follows:

 

trigger SendEmail on Opportunity (after update)
{
Set<Id> accountSet = new Set<Id>();
Set<Id> marketSet = new Set<Id>();

for (Opportunity o : Trigger.new) {
accountSet.add(o.Accountid);
marketSet.add(o.Campaignid);
}
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Name, Phone, PersonMobilePhone, PersonEmail from Account where id in :accountSet] );
map<Id, Campaign> marketMap = new Map<Id, Campaign>([SELECT Name, Parent_Market__c from Campaign where id in :marketSet]); 
for (Opportunity o : Trigger.new) {
if(o.Campaign_Type__c != Null && o.StageName != Null){
for (Integer i = 0; i < Trigger.old.size(); i++) {
Opportunity old = Trigger.old[i];
Opportunity nw = Trigger.new[i];
Account theAccount = accountMap.get(o.AccountId);
Campaign Market = marketMap.get(o.CampaignId);
String userName = UserInfo.getUserName();

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
List<String> toAddresses = new List<String>();
List<String> ccAddresses = new List<String>();
ccAddresses.add('test@test.com');
mail.setToAddresses(toAddresses); 
mail.setCcAddresses(ccAddresses);
mail.setSenderDisplayName('Campaign Information');

mail.setSubject(+ theAccount.Name + ' is Closed Won');

mail.setReplyTo('noreply@salesforce.com');
//Body of the Email
mail.setHtmlBody(
'<font face="Times" size="3">'+
'<table width="100%">'+
'<tr width="0%">'+
'<td rowspan="0">'+
'</td>'+
'<td>'+
'<h2>Account is closed won notification</h2>'+
'</td>'+
'</tr>'+
'</table>'+
'<br/>'+
'<b>Stage:</b> ' + o.StageName + '<br/>' + '<br/>' +
'<b>Opportunity Number:</b> ' + o.Name + '<br/>' +
'<b>Amount Paid:</b> $' + o.Amount + '<br/>' + '<br/>' +
'<b>Account Name:</b> ' + theAccount.Name + '<br/>' +
'<b>Phone:</b> ' + theAccount.Phone + '<br/>' +
'<b>Mobile:</b> ' + theAccount.PersonMobilePhone + '<br/>'+
'<b>Email:</b> ' + theAccount.PersonEmail + '<br/>'+
);

// Send Email if it isCampaign1 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign1')){
if(o.StageName.equals('Closed Won') ){
toAddresses.add(o.Email__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}

}
}
// Send Email if it is Campaign2 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign2')){
if(o.StageName.equals('Closed Won')){
toAddresses.add(o.Email2__c);
toAddresses.add(o.Email1__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}
}
} 
} 
}
} 
}

 

Any help would be appreciated.

Thanks

I am trying to integrate a 3rd party web app with my customer portal. There are 5 tabs on my customer portal out of which 2 of them references visualforce pages and the remaining 3 should reference 3 different pages in the web app. The integration need to be done in such a way that when a user click on any one of the 3 tabs which references the web app it should take the user to the individual web app pages associated with the tab.

E.g. If we have tab1, tab2, tab3, tab4 and tab5, tab1 and tab3 will take you to the respective visualforce pages associated with the tab. tab2 should take you to tab2 page on the web app Similarly, tab4 and tab5 should take me to tab4 and tab5 page on the webapp.

It should be a seamless integration and the user should not be aware of the fact that he is accessing 2 different apps. Would really appreciate if anyone could suggest me the best way to implement this.

I have created an opportunity trigger to send out an email to two separate email address field whenever the stage is Closed Won depending on the Campaign Type. It works perfectly fine but recently when I tried updating a list of 200 opportunity records it gave me an error saying "**Too many code statements 200001**".

 

My code is as follows:

 

trigger SendEmail on Opportunity (after update)
{
Set<Id> accountSet = new Set<Id>();
Set<Id> marketSet = new Set<Id>();

for (Opportunity o : Trigger.new) {
accountSet.add(o.Accountid);
marketSet.add(o.Campaignid);
}
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Name, Phone, PersonMobilePhone, PersonEmail from Account where id in :accountSet] );
map<Id, Campaign> marketMap = new Map<Id, Campaign>([SELECT Name, Parent_Market__c from Campaign where id in :marketSet]); 
for (Opportunity o : Trigger.new) {
if(o.Campaign_Type__c != Null && o.StageName != Null){
for (Integer i = 0; i < Trigger.old.size(); i++) {
Opportunity old = Trigger.old[i];
Opportunity nw = Trigger.new[i];
Account theAccount = accountMap.get(o.AccountId);
Campaign Market = marketMap.get(o.CampaignId);
String userName = UserInfo.getUserName();

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
List<String> toAddresses = new List<String>();
List<String> ccAddresses = new List<String>();
ccAddresses.add('test@test.com');
mail.setToAddresses(toAddresses); 
mail.setCcAddresses(ccAddresses);
mail.setSenderDisplayName('Campaign Information');

mail.setSubject(+ theAccount.Name + ' is Closed Won');

mail.setReplyTo('noreply@salesforce.com');
//Body of the Email
mail.setHtmlBody(
'<font face="Times" size="3">'+
'<table width="100%">'+
'<tr width="0%">'+
'<td rowspan="0">'+
'</td>'+
'<td>'+
'<h2>Account is closed won notification</h2>'+
'</td>'+
'</tr>'+
'</table>'+
'<br/>'+
'<b>Stage:</b> ' + o.StageName + '<br/>' + '<br/>' +
'<b>Opportunity Number:</b> ' + o.Name + '<br/>' +
'<b>Amount Paid:</b> $' + o.Amount + '<br/>' + '<br/>' +
'<b>Account Name:</b> ' + theAccount.Name + '<br/>' +
'<b>Phone:</b> ' + theAccount.Phone + '<br/>' +
'<b>Mobile:</b> ' + theAccount.PersonMobilePhone + '<br/>'+
'<b>Email:</b> ' + theAccount.PersonEmail + '<br/>'+
);

// Send Email if it isCampaign1 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign1')){
if(o.StageName.equals('Closed Won') ){
toAddresses.add(o.Email__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}

}
}
// Send Email if it is Campaign2 and Closed Won
if((nw.StageName !=old.StageName) || (nw.Campaign_Type__c !=old.Campaign_Type__c)){ 
if(o.Campaign_Type__c.equals('Campaign2')){
if(o.StageName.equals('Closed Won')){
toAddresses.add(o.Email2__c);
toAddresses.add(o.Email1__c);
try {
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
catch(Exception ex) { }
}
}
} 
} 
}
} 
}

 

Any help would be appreciated.

Thanks