• Margiro
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 11
    Replies

So I have a custom object called Materials that has data for a bunch of materials that go through lab tests. I need a way to add all of the data from the tests that dont have to do with the material to salesforce. However, I want to be able to see all of the tests for a material (some materials have more than one test) on the material record. What is the easiest way to do this? Do I have to make another custom object for the test data and then link it to the materials object?

Please Help!

 

-Matt

I recently downloaded Find Near By Accounts from the app exchange. However I am having problems with the apps geocoding service which runs with Google. I followed all the directions on how to correctly set up the application. My API is correct but when I click the button to map a near by account I get an error which says "Account can not be mapped (Google Exhausted)" I can see the map and all of the other material after I click ok to the error so the problem has to be coming from the geocoding. I get the same error when I run the Mass Geocode Account tab. I havent changed anything with the code so I dont know what could possibly be wrong with the application. Anyone have a solution to this problem?

 

Thanks,

Matt

I am looking to close a certain task that is on a bunch of leads. All the leads have a common field, D1 owner. I have selected all of the leads I need using SOQL,

Lead[] lds = [Select name, D1_Owner__c from Lead where D1_Owner__c='0017000000NnIX7'];

How can I change the status field to "completed" for the task on all of these leads?

 

Matt Argiro

PIAB USA

Does anyone have code that works successfully for Google Geocoding. I have tried just about every mapping application and none of the geocoding pieces work on Unlimited Edition. I have had no problems with any of the apps on my developer account. I get errors when saving in eclipse if i try and edit the code once it is installed. If anyone has any information on Google Geocoding and getting it to work correctly please reply or P.M. me.

 

Thanks,

Matt Argiro

PIAB USA

  • September 25, 2009
  • Like
  • 0

Im working with the code found here for the google maps API. I successfully got the geocoding to work but when i run the page given to show the map, I get a blank error message and the map doesnt render.

Heres the page code just in case...

 

<apex:page sidebar="false" controller="GoogleMapController"> <c:GoogleMap mapType="normal" mapkey="{!forcekey}" data="{!geoDataTable}"/> </apex:page>

 

 

 

Im working on a part of a class that creates a wizard but I cant successfully write a test code for it. I have one below and I cant understand why it doesnt work. Why wont this code work?

 

Heres the part of the class that needs testing-

 

public PageReference step1() { return Page.mhform1; } public PageReference step2() { return Page.mhform2; } public PageReference step3() { return Page.mhform3; } public PageReference step4() { return Page.mhformconfirm; }

 

 Heres what I have made for a test code so far-

@isTest private class testGLeadExtention { static testMethod void step1Test() { // TO DO: implement unit test PageReference step1 = Page.mhform1; Test.setCurrentPageReference(step1); } static testMethod void step2Test() { // TO DO: implement unit test PageReference step2 = Page.mhform2; Test.setCurrentPageReference(step2); } static testMethod void step3Test() { // TO DO: implement unit test PageReference step3 = Page.mhform3; Test.setCurrentPageReference(step3); } static testMethod void step4Test() { // TO DO: implement unit test PageReference step4 = Page.mhformconfirm; Test.setCurrentPageReference(step4); } }

 


 

Im having a problem as explained here. I was told that it is because of a lack of test coverage but Im new to this and dont know how to write test code to cover the class. How do I write this code? Thanks in advance for your help!

-Matt

 

Here is the code for my class:

 

public class GLeadExtension { public Lead Lead1 ; public GLeadExtension(ApexPages.StandardController controller) { Lead1 = (Lead)controller.getRecord(); Lead1.D1_Owner__c = '0017000000NnIX7'; Lead1.D2_Owner__c = '0017000000NnIX7'; } public PageReference step1() { return Page.mhform1; } public PageReference step2() { return Page.mhform2; } public PageReference step3() { return Page.mhform3; } public PageReference step4() { return Page.mhformconfirm; } public PageReference save() { PageReference pdf = Page.mhformconfirm; pdf.getParameters().put('p','p'); pdf.setRedirect(false); Blob b = pdf.getContent(); Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setSubject('Conveying Application request'); String [] toAddresses = new String[] {'margiro@piab.com'}; email.setToAddresses(toAddresses); email.setPlainTextBody('An order has been placed for a conveyor'); Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName(Lead1.company + '.pdf'); efa.setBody(b); email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); //leadsave(); //this.standardController.save(); insert Lead1; //this is my logic for where I want to go after stuff is saved PageReference nextPage = new PageReference('/apex/mhformendpage'); nextPage .setRedirect(true); return nextpage; //return page.mhformendpage; } }

 

 

 

Im working on a part of my class which sends an email when a form is completed. I have it up and working successfully using my email address in the code. But, the email is not supposed to go to me and when I go to change it the code wont save to server. Any help? The part of my code is below. The email address needed to be changed is in the ToAddresses string. I believe it is because of a lack of test code but Ive had no success in writing one that fixes the problem.

 

-Matt

 

 

public PageReference save() {
PageReference pdf = Page.mhformconfirm;
pdf.getParameters().put('p','p');
pdf.setRedirect(false);
Blob b = pdf.getContent();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Conveying Application request');
String [] ToAddresses = new String[] {'margiro@piab.com'};
email.setToAddresses(ToAddresses);
email.setPlainTextBody('An order has been placed for a conveyor');
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName(Lead1.company + '.pdf');
efa.setBody(b);
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
insert Lead1;
PageReference nextPage = new PageReference('/apex/mhformendpage');
nextPage .setRedirect(true);
return nextpage;
}

 

 

 

Message Edited by Margiro on 07-22-2009 10:24 AM
I wrote a wizard using the controller and it uses 4 visualforce pages to work. The last page is supposed to be rendered as a pdf. So I added in code to the controller that uses that pdf as an email attachment based of this model. I dont get any error when saving the code but when I access the Sites page it says I dont have authorization. How can I fix this? Note: Worked perfectly before I added in the red highlighted part of the code below.

public class GLeadExtension {
public Lead aLead ;
public GLeadExtension() {
ApexPages.StandardController controller;
aLead = new Lead() ;
}
public PageReference step1() {
return Page.mhform422;
}
public PageReference step2() {
return Page.mhformpt2422;
}
public PageReference step3() {
return Page.mhformpt3422;
}
public PageReference step4() {
return Page.mhformconfirm;
}
public PageReference step5() {
return Page.mhformendpage;
}
public PageReference home() {
return Page.FileNotFound;
}
public PageReference getPDF() {
PageReference pdf = Page.mhformconfirm;
pdf.getParameters().put('p','p');
pdf.setRedirect(true);
Blob b = pdf.getContent();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('From PDF');
String [] toAddresses = new String[] {'margiro@piab.com'};
email.setToAddresses(toAddresses);
email.setPlainTextBody('Here is the body of the email');
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('{!relatedTo}.pdf');
efa.setBody(b);
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
return Page.mhformendpage;
}
}

 

Hello

I have written a trigger that sends an email when a lead is updated. However I only want the email to be sent when a lead is created using a visualforce page not when a lead is created directly form salesforce. Currently, the trigger is selecting the last created lead not necessarily the lead created using the page. How can I limit the trigger so that it only sends using the vf page and not the interface? Or, do I have to send the email using a different method?

Trigger

 

trigger mhform on Lead (after insert) { Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'margiro@piab.com'}; Lead lead = [SELECT Id from Lead Order by Lead.createdDate Desc limit 1]; mail.setToAddresses(toAddresses); mail.setTemplateId('00X400000016by4'); mail.setTargetObjectId(lead.Id); mail.setReplyTo('support@acme.com'); mail.setSenderDisplayName('Piab Support'); mail.setSaveAsActivity(false); mail.setBccSender(false); mail.setUseSignature(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail}); }

 


 

So I have a trigger based off of a VF page and need to send a bunch of fields from that page in an email pdf attachment. The email is sending with a blank pdf because it isnt retrieving any id for that lead. How do I correctly call the lead?

This code apparently doesnt work Error - Compile Error: Method does not exist or incorrect signature: lead.getId() at line 6 column 13

 

 

trigger mhform on Lead (after insert) { Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'margiro@piab.com'}; mail.setToAddresses(toAddresses); mail.setTemplateId('00X400000016by4'); string i = lead.getId(); mail.settargetObjectId(i); mail.setReplyTo('support@acme.com'); mail.setSenderDisplayName('Piab Support'); mail.setSaveAsActivity(false); mail.setBccSender(false); mail.setUseSignature(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail}); }

 

 

 

I have written the code for an email template that is used by a trigger. The template is supposed to render a bunch of information from the VF into a pdf. This works in the email template preview but not when the vf page is completed. I believe it has to do with recipientType or relatedToType but neither of them work. Also can I get the setobjectId to generate the lead id when the email sets insted of having it as a non variable.  How do I link the information on the VF page to the PDF file?

 

Template Code

 

<messaging:emailTemplate subject="Conveyor Form Entered" recipientType="lead"> <messaging:htmlEmailBody > A new order has been entered for a conveyor. </messaging:htmlEmailBody> <messaging:attachment renderAs="pdf" filename="{!recipient.company}" > <br><b>Lead ID:</b>{!recipient.id}</br> <br></br> <br><u><b>Contact Information</b></u></br> <br><b>Name:</b>{!recipient.firstname} {!recipient.lastname}</br> <br><b>Email:</b>{!recipient.email}</br> <br><b>Company:</b>{!recipient.company}</br> <br><b>Website:</b>{!recipient.website}</br> <br><b>Title:</b>{!recipient.title}</br> <br><b>Phone/Fax:</b>{!recipient.phone}/{!recipient.fax}</br> <br><b>Address:</b><ADDRESS>{!recipient.street}</br> <br>{!recipient.city},{!recipient.state}</br> <br>{!recipient.postalcode} {!recipient.country}</br></ADDRESS> <br><u><b>Product Information</b></u></br> <br><b>Product Conveyed:</b>{!recipient.Product_conveyed__c}</br> <br><b>Bulk Density:</b>{!recipient.Bulk_density__c}{!recipient.Bulk_Density_Units__c}</br> <br><b>Particle Size:</b>{!recipient.Particle_size__c}{!recipient.Particle_Size_Units__c}</br> <br><b>Angle of Repose:</b>{!recipient.Angle_of_repose__c}</br> <br><b>Flow:</b>{!recipient.Flow__c}</br> <br><b>Hazards:</b>{!recipient.Hazards__c}</br> <br><b>Other Properties:</b>{!recipient.Other_product_properties__c}</br> <br></br> <br><u><b>Installation Information</b></u></br> <br><b>Capacity:</b>{!recipient.Capacity__c}{!recipient.Capacity_Units__c}</br> <br><b>Total Conveying Distance:</b>{!recipient.Total_conveying_distance__c}{!recipient.Total_Conveying_Distance_Units__c}</br> <br><b>Horizontal:</b>{!recipient.Horizontal__c}{!recipient.Horizontal_Units__c}</br> <br><b>Vertical:</b>{!recipient.Vertical__c}{!recipient.Vertical_Units__c}</br> <br><b>Max Headroom:</b>{!recipient.Max_Headroom__c}{!recipient.Max_Headroom_Units__c}</br> <br><b>Number of Bends:</b>{!recipient.Number_of_bends__c}</br> <br><b>Type of Pipe System:</b>{!recipient.Type_of_pipe_system__c}</br> <br><b>Product Picked Up From:</b>{!recipient.Product_picked_up_from__c}</br> <br><b>Other Pick Up:</b>{!recipient.If_Others__c}</br> <br><b>Product Discharged To:</b>{!recipient.Product_Discharge__c}</br> <br><b>Other Discharge:</b>{!recipient.If_Others2__c}</br> <br><b>Installation is:</b>{!recipient.The_installation_is__c}</br> <br><b>The Operation is:</b>{!recipient.The_operation_is__c}</br> <br><b>Project Timeline:</b>{!recipient.Project_Timeline__c}</br> <br><b>Other Information:</b>{!recipient.Other_information__c}</br> </messaging:attachment> </messaging:emailTemplate>

 Trigger Code

 

trigger mhform on Lead (after insert) { Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'margiro@piab.com'}; mail.setToAddresses(toAddresses); mail.setTemplateId('00X400000016by4'); mail.settargetObjectId(!relatedTo.lead.id); mail.setReplyTo('support@acme.com'); mail.setSenderDisplayName('Piab Support'); mail.setSaveAsActivity(false); mail.setBccSender(false); mail.setUseSignature(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail}); }

 

 

I wrote a trigger to send an email but I dont know how to make it send field values from the new lead in the email body...Any help?

trigger mhform on Lead (after insert) {
Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{'margiro@piab.com'};
mail.setToAddresses(toAddresss);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Conveyor Order');
mail.setBccSender(false);
mail.setUseSignature(false);\

String msg = 'new conveyor ordered';

mail.setHtmlBody(msg);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});
}

I have a basic email being sent using this code:

public PageReference step3() {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{'margiro@piab.com'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Conveyor Order');
mail.setBccSender(false);
mail.setUseSignature(false);
String msg = 'new conveyor ordered';
mail.setHtmlBody(msg+ lead.company);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
return Page.mhformpt3422;
}

 There are two things i need to do to it to make it work more efficient.

  1. I need this email code to work for the save button not the custom step3 button that I have it working on now.        .
  2. I also would like the email to return the msg string plus either the id of the lead with a hyperlink to it on the site(prefered ove other option) or the company of the lead that was created.(I thought that this is set up correctly in the code now but it does not return a value)

Any help is greatly appreciated!

 

Thanks,

Matt

Message Edited by Margiro on 05-28-2009 01:02 PM

Im having email problems with this code:

public class GLeadExtension {
public Lead aLead ;
public GLeadExtension(ApexPages.StandardController controller) {
aLead = new Lead() ;
}
public PageReference step1() {
return Page.mhform422;
}
public PageReference step2() {
return Page.mhformpt2422;
}
public PageReference step3() {
return Page.mhformpt3422;
}
public PageReference step4() {
return Page.mhformconfirm;
}
public PageReference step5(string emailTo) {
return Page.mhformendpage;
}
public PageReference home() {
return Page.FileNotFound;
}

public static void send (string emailTo){
String[] toAddresses = new String[] {'margiro@piab.com'};
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Case Created');
mail.setBccSender(false);
mail.setUseSignature(false);
String msg = 'An order has been placed for a conveyor';
mail.setHtmlBody(msg);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}

public PageReference save() {
PageReference pr ;
try{
//ZillowService p = new ZillowService() ;
// make the web service call out
//ZillowTypes.PropertySearchResponse r = p.searchZillow( aLead.Street, aLead.City, aLead.State) ;
// store in custom field
//aLead.Home_Value__c = r.getZEstimateAmount() ;
// insert new record into DB
insert aLead ;
// redirect to the newly inserted lead
// pr = new PageReference( 'http://www.piab.com' );
pr = new PageReference( '/' + aLead.id );
}
catch( Exception e){
System.debug( '**** Caught Exception' +e ) ;
}
return pr ;

}
}

 I believe that the section that should create an email and send a message to myself after someone fills out a form is in the right place and is linked correctly to the step5 button. When the button is pressed on the site, it redirects to another page(the generic unauthorized page) instead of the mhformendpage like its supposed to.  Anyone see what is wrong with this?

I have a 3 page wizard with a save button on the last page. After all the data is entered an i go to hit save the page seems to just refresh over and over again. The data in the form isnt lost but i can not redirect away to finish the wizard. How can I fix this?

I'm trying to create an email that is sent automatically when a form is completed.Here's what my controller for the form I'm working on looks like:

public class GLeadExtension {
public Lead aLead ;
public GLeadExtension(ApexPages.StandardController controller) {
aLead = new Lead() ;
}
public PageReference step1() {
return Page.mhform422;
}
public PageReference step2() {
return Page.mhformpt2422;
}
public PageReference step3() {
return Page.mhformpt3422;
}
public PageReference step4() {
return Page.mhformconfirm;
}

public PageReference step5(string emailTo) {
return Page.mhformendpage;
}
public PageReference home() {
return Page.FileNotFound;
}

public static void send (string emailTo){
String[] toAddresses = new String[] {'margiro@piab.com'};
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Case Created');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setPlainTextBody('An order for a conveyor has been created');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}

public PageReference save() {
PageReference pr ;
try{
//ZillowService p = new ZillowService() ;
// make the web service call out
//ZillowTypes.PropertySearchResponse r = p.searchZillow( aLead.Street, aLead.City, aLead.State) ;
// store in custom field
//aLead.Home_Value__c = r.getZEstimateAmount() ;
// insert new record into DB
insert aLead ;
// redirect to the newly inserted lead
// pr = new PageReference( 'http://www.piab.com' );
pr = new PageReference( '/' + aLead.id );
}
catch( Exception e){
System.debug( '**** Caught Exception' +e ) ;
}
return pr ;

}
}

 

This doesn't send an email even though I believe I linked the button with the message code correctly because on the site it brings me to another page which makes me think that the email is tying to be sent. Is this code correct?

 
Message Edited by Margiro on 05-05-2009 01:57 PM
I would like to combine two custom fields ive created into one area of a page. It is for the units of a value that is entered into a text box. To better explain, i have a capacity field where the person enters in a numeric value but the value can be in 3 possible units of measure. I want a dropdown list immediately to the right of the field that has these units in it. How can I do this?
Message Edited by Margiro on 04-30-2009 01:54 PM

I need to have an email sent to myself when a new order is placed. It needs to be triggered when the final save button is hit(its in a wizard). I need the "save" button to first save,then trigger the email and perform "step4" action which brings it to an alternate confirmation page. How do I create this trigger?

Heres VF page code:

<apex:page sidebar="false" standardController="lead"   showHeader="false" extensions="GLeadExtension"> 
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<h1>Conveyor Application Request Part 3/3</h1>
<apex:form >
<apex:pageBlock >


<apex:pageBlockButtons >
<apex:commandButton action="{!step4}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Installation - Additional Information" columns="2">
<apex:inputField value="{!Lead.Capacity_ton_h__c}"/>
<apex:inputField value="{!Lead.Other_intervals__c}"/>
<apex:inputField value="{!Lead.Total_conveying_distance_m__c}"/>
<apex:inputField value="{!Lead.Horizontal_m__c}"/>
<apex:inputField value="{!Lead.Vertical_m__c}"/>
<apex:inputField value="{!Lead.Number_of_bends__c}"/>
<apex:inputField value="{!Lead.Type_of_pipe_system__c}"/>
<apex:inputField value="{!Lead.Diameter__c}"/>
<apex:inputField value="{!Lead.Humidity_of_the_product__c}"/>
<apex:inputField value="{!Lead.Hygroscopic_moisture__c}"/>
<apex:inputField value="{!Lead.Product_picked_up_from__c}"/>
<apex:inputField value="{!Lead.If_Others__c}"/>
<apex:inputField value="{!Lead.The_installation_is__c}"/>
<apex:inputField value="{!Lead.The_operation_is__c}"/>
<apex:inputField value="{!Lead.Other_information__c}"/>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
Message Edited by Margiro on 04-24-2009 07:46 AM
Message Edited by Margiro on 04-24-2009 07:48 AM

Im working on a form where data is put in for an order. The data inputs are split into 5 separate pageBlockSections. How can I take each one of my pageBlockSections and make it a separate page. I want a next button down bottom but dont know how to override the save button and make it go to the next page. Heres the code:

<apex:page sidebar="false" standardController="lead"   showHeader="false" extensions="GLeadExtension"> 
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<h1>Conveyor Application Request</h1>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Company Detail" columns="2">
<apex:inputField value="{!Lead.company}"/>
<apex:inputField value="{!Lead.website}"/>
<apex:inputField value="{!Lead.firstname}"/>
<apex:inputField value="{!Lead.lastname}"/>
<apex:inputField value="{!Lead.title}"/>

<apex:inputField value="{!Lead.email}"/>
<apex:inputField value="{!Lead.street}"/>
<apex:inputField value="{!Lead.city}"/>
<apex:inputField value="{!Lead.state}"/>
<apex:inputField value="{!Lead.postalcode}"/>
<apex:inputField value="{!Lead.country}"/>
<apex:inputField value="{!Lead.phone}"/>
<apex:inputField value="{!Lead.fax}"/>
<apex:inputField value="{!Lead.status}"/>
</apex:pageBlockSection>



<apex:pageBlockSection title="Product Conveyed - Additional Information" columns="2">

<apex:inputField value="{!Lead.Product_conveyed__c}"/>
<apex:inputField value="{!Lead.Chemical_formula__c}"/>
<apex:inputField value="{!Lead.Bulk_density_kg_dm3__c}"/>
<apex:inputField value="{!Lead.Particle_size_max_m__c}"/>
<apex:inputField value="{!Lead.Particle_size_min_m__c}"/>
<apex:inputField value="{!Lead.Majority_between_start__c}"/>
<apex:inputField value="{!Lead.end_m__c}"/>
<apex:inputField value="{!Lead.Is_the_product_abrasive__c}"/>
<apex:inputField value="{!Lead.Flowability__c}"/>

<apex:inputField value="{!Lead.The_product_is__c}"/>
<apex:inputField value="{!Lead.Aggressive_in_other_ways_additional_info__c}"/>
<apex:inputField value="{!Lead.Angle_of_repose__c}"/>
<apex:inputField value="{!Lead.Other_product_properties__c}"/>
</apex:pageBlockSection>


<apex:pageBlockSection title="Installation - Additional Information" columns="2">
<apex:inputField value="{!Lead.Capacity_ton_h__c}"/>
<apex:inputField value="{!Lead.Other_intervals__c}"/>
<apex:inputField value="{!Lead.Total_conveying_distance_m__c}"/>
<apex:inputField value="{!Lead.Horizontal_m__c}"/>
<apex:inputField value="{!Lead.Vertical_m__c}"/>
<apex:inputField value="{!Lead.Number_of_bends__c}"/>
<apex:inputField value="{!Lead.Type_of_pipe_system__c}"/>
<apex:inputField value="{!Lead.Diameter__c}"/>
<apex:inputField value="{!Lead.Humidity_of_the_product__c}"/>
<apex:inputField value="{!Lead.Hygroscopic_moisture__c}"/>
<apex:inputField value="{!Lead.Product_picked_up_from__c}"/>
<apex:inputField value="{!Lead.If_Others__c}"/>
<apex:inputField value="{!Lead.The_installation_is__c}"/>
<apex:inputField value="{!Lead.The_operation_is__c}"/>
<apex:inputField value="{!Lead.Other_information__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>

So I have a custom object called Materials that has data for a bunch of materials that go through lab tests. I need a way to add all of the data from the tests that dont have to do with the material to salesforce. However, I want to be able to see all of the tests for a material (some materials have more than one test) on the material record. What is the easiest way to do this? Do I have to make another custom object for the test data and then link it to the materials object?

Please Help!

 

-Matt

Does anyone have code that works successfully for Google Geocoding. I have tried just about every mapping application and none of the geocoding pieces work on Unlimited Edition. I have had no problems with any of the apps on my developer account. I get errors when saving in eclipse if i try and edit the code once it is installed. If anyone has any information on Google Geocoding and getting it to work correctly please reply or P.M. me.

 

Thanks,

Matt Argiro

PIAB USA

  • September 25, 2009
  • Like
  • 0

Im working with the code found here for the google maps API. I successfully got the geocoding to work but when i run the page given to show the map, I get a blank error message and the map doesnt render.

Heres the page code just in case...

 

<apex:page sidebar="false" controller="GoogleMapController"> <c:GoogleMap mapType="normal" mapkey="{!forcekey}" data="{!geoDataTable}"/> </apex:page>

 

 

 

I wrote a wizard using the controller and it uses 4 visualforce pages to work. The last page is supposed to be rendered as a pdf. So I added in code to the controller that uses that pdf as an email attachment based of this model. I dont get any error when saving the code but when I access the Sites page it says I dont have authorization. How can I fix this? Note: Worked perfectly before I added in the red highlighted part of the code below.

public class GLeadExtension {
public Lead aLead ;
public GLeadExtension() {
ApexPages.StandardController controller;
aLead = new Lead() ;
}
public PageReference step1() {
return Page.mhform422;
}
public PageReference step2() {
return Page.mhformpt2422;
}
public PageReference step3() {
return Page.mhformpt3422;
}
public PageReference step4() {
return Page.mhformconfirm;
}
public PageReference step5() {
return Page.mhformendpage;
}
public PageReference home() {
return Page.FileNotFound;
}
public PageReference getPDF() {
PageReference pdf = Page.mhformconfirm;
pdf.getParameters().put('p','p');
pdf.setRedirect(true);
Blob b = pdf.getContent();
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('From PDF');
String [] toAddresses = new String[] {'margiro@piab.com'};
email.setToAddresses(toAddresses);
email.setPlainTextBody('Here is the body of the email');
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('{!relatedTo}.pdf');
efa.setBody(b);
email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
return Page.mhformendpage;
}
}

 

Hello

I have written a trigger that sends an email when a lead is updated. However I only want the email to be sent when a lead is created using a visualforce page not when a lead is created directly form salesforce. Currently, the trigger is selecting the last created lead not necessarily the lead created using the page. How can I limit the trigger so that it only sends using the vf page and not the interface? Or, do I have to send the email using a different method?

Trigger

 

trigger mhform on Lead (after insert) { Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); String[] toAddresses = new String[]{'margiro@piab.com'}; Lead lead = [SELECT Id from Lead Order by Lead.createdDate Desc limit 1]; mail.setToAddresses(toAddresses); mail.setTemplateId('00X400000016by4'); mail.setTargetObjectId(lead.Id); mail.setReplyTo('support@acme.com'); mail.setSenderDisplayName('Piab Support'); mail.setSaveAsActivity(false); mail.setBccSender(false); mail.setUseSignature(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail}); }

 


 

I have a basic email being sent using this code:

public PageReference step3() {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{'margiro@piab.com'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Conveyor Order');
mail.setBccSender(false);
mail.setUseSignature(false);
String msg = 'new conveyor ordered';
mail.setHtmlBody(msg+ lead.company);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
return Page.mhformpt3422;
}

 There are two things i need to do to it to make it work more efficient.

  1. I need this email code to work for the save button not the custom step3 button that I have it working on now.        .
  2. I also would like the email to return the msg string plus either the id of the lead with a hyperlink to it on the site(prefered ove other option) or the company of the lead that was created.(I thought that this is set up correctly in the code now but it does not return a value)

Any help is greatly appreciated!

 

Thanks,

Matt

Message Edited by Margiro on 05-28-2009 01:02 PM
I would like to combine two custom fields ive created into one area of a page. It is for the units of a value that is entered into a text box. To better explain, i have a capacity field where the person enters in a numeric value but the value can be in 3 possible units of measure. I want a dropdown list immediately to the right of the field that has these units in it. How can I do this?
Message Edited by Margiro on 04-30-2009 01:54 PM

I need to have an email sent to myself when a new order is placed. It needs to be triggered when the final save button is hit(its in a wizard). I need the "save" button to first save,then trigger the email and perform "step4" action which brings it to an alternate confirmation page. How do I create this trigger?

Heres VF page code:

<apex:page sidebar="false" standardController="lead"   showHeader="false" extensions="GLeadExtension"> 
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<h1>Conveyor Application Request Part 3/3</h1>
<apex:form >
<apex:pageBlock >


<apex:pageBlockButtons >
<apex:commandButton action="{!step4}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Installation - Additional Information" columns="2">
<apex:inputField value="{!Lead.Capacity_ton_h__c}"/>
<apex:inputField value="{!Lead.Other_intervals__c}"/>
<apex:inputField value="{!Lead.Total_conveying_distance_m__c}"/>
<apex:inputField value="{!Lead.Horizontal_m__c}"/>
<apex:inputField value="{!Lead.Vertical_m__c}"/>
<apex:inputField value="{!Lead.Number_of_bends__c}"/>
<apex:inputField value="{!Lead.Type_of_pipe_system__c}"/>
<apex:inputField value="{!Lead.Diameter__c}"/>
<apex:inputField value="{!Lead.Humidity_of_the_product__c}"/>
<apex:inputField value="{!Lead.Hygroscopic_moisture__c}"/>
<apex:inputField value="{!Lead.Product_picked_up_from__c}"/>
<apex:inputField value="{!Lead.If_Others__c}"/>
<apex:inputField value="{!Lead.The_installation_is__c}"/>
<apex:inputField value="{!Lead.The_operation_is__c}"/>
<apex:inputField value="{!Lead.Other_information__c}"/>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
Message Edited by Margiro on 04-24-2009 07:46 AM
Message Edited by Margiro on 04-24-2009 07:48 AM

Im working on a form where data is put in for an order. The data inputs are split into 5 separate pageBlockSections. How can I take each one of my pageBlockSections and make it a separate page. I want a next button down bottom but dont know how to override the save button and make it go to the next page. Heres the code:

<apex:page sidebar="false" standardController="lead"   showHeader="false" extensions="GLeadExtension"> 
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<h1>Conveyor Application Request</h1>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Company Detail" columns="2">
<apex:inputField value="{!Lead.company}"/>
<apex:inputField value="{!Lead.website}"/>
<apex:inputField value="{!Lead.firstname}"/>
<apex:inputField value="{!Lead.lastname}"/>
<apex:inputField value="{!Lead.title}"/>

<apex:inputField value="{!Lead.email}"/>
<apex:inputField value="{!Lead.street}"/>
<apex:inputField value="{!Lead.city}"/>
<apex:inputField value="{!Lead.state}"/>
<apex:inputField value="{!Lead.postalcode}"/>
<apex:inputField value="{!Lead.country}"/>
<apex:inputField value="{!Lead.phone}"/>
<apex:inputField value="{!Lead.fax}"/>
<apex:inputField value="{!Lead.status}"/>
</apex:pageBlockSection>



<apex:pageBlockSection title="Product Conveyed - Additional Information" columns="2">

<apex:inputField value="{!Lead.Product_conveyed__c}"/>
<apex:inputField value="{!Lead.Chemical_formula__c}"/>
<apex:inputField value="{!Lead.Bulk_density_kg_dm3__c}"/>
<apex:inputField value="{!Lead.Particle_size_max_m__c}"/>
<apex:inputField value="{!Lead.Particle_size_min_m__c}"/>
<apex:inputField value="{!Lead.Majority_between_start__c}"/>
<apex:inputField value="{!Lead.end_m__c}"/>
<apex:inputField value="{!Lead.Is_the_product_abrasive__c}"/>
<apex:inputField value="{!Lead.Flowability__c}"/>

<apex:inputField value="{!Lead.The_product_is__c}"/>
<apex:inputField value="{!Lead.Aggressive_in_other_ways_additional_info__c}"/>
<apex:inputField value="{!Lead.Angle_of_repose__c}"/>
<apex:inputField value="{!Lead.Other_product_properties__c}"/>
</apex:pageBlockSection>


<apex:pageBlockSection title="Installation - Additional Information" columns="2">
<apex:inputField value="{!Lead.Capacity_ton_h__c}"/>
<apex:inputField value="{!Lead.Other_intervals__c}"/>
<apex:inputField value="{!Lead.Total_conveying_distance_m__c}"/>
<apex:inputField value="{!Lead.Horizontal_m__c}"/>
<apex:inputField value="{!Lead.Vertical_m__c}"/>
<apex:inputField value="{!Lead.Number_of_bends__c}"/>
<apex:inputField value="{!Lead.Type_of_pipe_system__c}"/>
<apex:inputField value="{!Lead.Diameter__c}"/>
<apex:inputField value="{!Lead.Humidity_of_the_product__c}"/>
<apex:inputField value="{!Lead.Hygroscopic_moisture__c}"/>
<apex:inputField value="{!Lead.Product_picked_up_from__c}"/>
<apex:inputField value="{!Lead.If_Others__c}"/>
<apex:inputField value="{!Lead.The_installation_is__c}"/>
<apex:inputField value="{!Lead.The_operation_is__c}"/>
<apex:inputField value="{!Lead.Other_information__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>

There is a known issue where Tasks created via Mass Emailing are not set to Type=Email.  I'm trying to develop an Apex class (possibly a custom controller for VF) that will allow me to have someone go in and hit a button that will set all the Nulls to Email for the Tasks created by Mass Email.

 

Here is my code, which works using anonymous execution, however, it came close to the governance limits (10k).

 

public class nullTaskCleanup { for (Task[] badTypes : [select Id, Type from Task where Type=Null AND Subject LIKE '%Email%']) { for(Task t : badTypes) { t.type = 'Email'; } update badTypes; } }

 

 1. Why am I running into governance limits, I thought using the code above would 'chunk' it and avoid this issue.

 

2. When I try to save the above, I get an error saying that it expected a } on the second line.

 

Thanks for any help on this.

Barry