• dotnet develope
  • NEWBIE
  • 208 Points
  • Member since 2007

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 53
    Replies

Hi All,

 

Sure this is a syntax problem, but cant get my head around it:

 

{!REQUIRESCRIPT("/soap/ajax/18.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/18.0/apex.js")} 

var connection =sforce.connection; 
var CA = "{!CMC__c.DEBUG_ofCompletedAssessments__c}";
var User = "{!$User.Full_Name__c}",
var CR = "{!CMC__c.Case_Reason__c}",
var URL = "{!CMC__c.UAT_QAT_Zoomerang_URL__c}",

IF( 
                AND( 
                                CA <1, 
                                OR( 
                                                CR = "New Script QAT", 
                                                CR = "New Script UAT"
                                  )
                                )
                { 
                                window.open('URL');
                }
)
else{
alert("Either an Assessment is not applicable for this case, or you are not authorised to complete assessments");
}

 

 

 I get 'Unexpected Identifier' when clicking?

 

Any help appreciated.

Hi everyone,

 

i want to export data to excel using vfpage.

So i did like this.i put the content type as  folllows.its working fine.

<apex:page standardcontroller="Quote" contentType="application/vnd.ms-excel" cache="true">
  <apex:pageBlock title="Quotes">
      <apex:pageBlockTable value="{!Quote}" var="q">
         <apex:column />
         <apex:column value="{!q.id}"/>
         <apex:column value="{!q.Name}"/>
         <apex:column value="{!q.Subtotal}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
 
</apex:page>

 

Currently the filename of the excel and sheet name is my vfpage name-ExportQuotes.But if i want to display the products also in the same file but as different sheet.ie:Quote in Sheet1  and QuoteLine Items in Sheet2 in same page.is it posible.Can anyone help me on this?Its urgent.........

  • April 28, 2011
  • Like
  • 0

Hi I am trying to create a trigger to update the check box whenever the Opportunity stage changes from Closed Won to a new stage. Here is the trigger i wrote and it is throwing me an error. Please let me know whether the way i wrote the trigger is write or wrong. I mentioned the error in Red color 

 

 

trigger OpportunityUpdate on Opportunity (after update)
{
List <Opportunity> OppList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
    if (Trigger.old[i].StageName == 'Closed Won' && Trigger.new[i].StageName != 'Closed Won')
        
        oppIdList.add(Trigger.new[i].Id);
}   
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where opportunity  :oppIdList];
if (OppList.size() > 0)
{
  
        if (Opportunity.Not_Closed_won__c != true)
        {
           Opportunity.Not_Closed_won__c = true;  
           }
    }
    
    update OppList;
    }

 

Hi,

 

Our company is based in Europe and we use Euro as the default currency, but we also use Dollar.

 

All days we have to manually edit rates 

 

How can I automatically update  dollar rates? 

Api, Apex.......is it possible to call a RSS?

 

Thanks!!!!!

  • April 19, 2011
  • Like
  • 0

Hi,

 

I have a functionality where users would click on the register link.

 

a) if users are logged in to the portal and click on the register link, i need to insert a record in my custom object  who clicked on the register link (Contact info : email, name) and  display thanks for registering in VF page.

 

b) If users are not logged in to the portal(are on site) and click on the register link, system should re-direct the user to portal login page and upon successful login users should come back to this register link page and functionality of a).

 

I am confused about the re-direction to login page and upon successful login how to re-direct the user to same page from where user clicked on register link. Can some one provide sample code?

 

Thanks.

 

 

  • April 18, 2011
  • Like
  • 0

Hi All

I want to extract time for my local time zone which i have set in my personal information

 

like  consider apex code below:

 

DateTime cDT = system.Now();

String localDateTime = cDT.format();

 

now localDateTime will be like 4/1/2011 4:22 PM

 

I want to extract 4:22 PM out of this

 

One method given in salesforce documentation is hour,minute methods. But this method takes datetime as argument. But our format method returnes a string.

 

The solution may be convert the string returned by format method to datetime type.

But could not. i tried parse method. it converted my local time back to GMT Time. Secondly i tried valueOf Method. But it accepts string in a specific format. 

 

Please help me solving this problem. I have tries from my side. searched on net. but got no solution

 

 

Hi,

   I created Page for custom save controller. my page apex code given below...

 

<apex:page controller="newOpportunityController11" tabStyle="Account">
<apex:form >
<apex:pageBlock title="Congratulations">
<apex:inputField value="{!Invoice.Name}"/>
<apex:inputField value="{!Invoice.Line_Item__c}"/>
<apex:inputField value="{!Invoice.Pay_by_Date__c}"/>
<apex:inputField value="{!Invoice.Total_Amount__c}"/>
<apex:inputField value="{!Invoice.Client_Name__c}"/>
<apex:inputField value="{!Invoice.Invoice_Status__c}"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlock>
</apex:form>
</apex:page>
and my apex class is...
public class newOpportunityController11
 {  
Opportunity opportunity;
public Invoice__c invoice{ get; set; }
public Opportunity getOpportunity() {
//if(opportunity == null) opportunity = new Opportunity();
return opportunity;
}
public Invoice__c getinvoice() {
//if(Invoice == null) Invoice = new Invoice__c();
Id id = ApexPages.currentPage().getParameters().get('id');
invoice= [SELECT Client_Name__c,Invoice_Status__c,Line_Item__c,Pay_by_Date__c,Total_Amount__c FROM Invoice__c WHERE id = :id];
return invoice;
}
public PageReference cancel() {
PageReference opportunityPage = new ApexPages.StandardController(opportunity).view();
opportunityPage.setRedirect(true);
return opportunityPage;
}
public PageReference save() 
{
update invoice;
return null;
}
}
the above page and class was successfully save without error... and then when i run this page and enter the data then click save button the error given below error is occur...
System.NullPointerException: Attempt to de-reference a null object

 

Class.newOpportunityController11.save: line 47, column 8 External entry point
How to solve this....pls help

 

 

 

 

 

  • January 25, 2011
  • Like
  • 0

Hi All,

 

I wrote a trigger on event object (before insert/update events).

its working fine when i create or edit the record , but it fails when i update the event startdate through calendar (ie changing the time of the event ). 

The trigger is not invoked.

 

Could you please suggest me.

 

Thanks in advance.

 

 

 

How To Find Total Code Coverage in Eclipse %

Hi All,

 

  I want to create a event on calendar through custom code.

 

I found that for creating a event on calendar, it takes default value as 'Non-group Event'' for groupeventtype  when invitees are given.

 

 ** if the invitees are not assinged then groupeventtype value be 0 (ie 'non-even event').

 

But my code should work, i am not adding any invitees to the event.

 

 Event newevent = new Event();
newevent.ownerid = '00590000000mytG';
newevent.startdatetime = datetime.valueOf('2011-10-21 09:00:00Z');
newevent.enddatetime = datetime.valueOf('2011-10-21 10:00:00Z');
newevent.subject = 'My Call';
newevent.whoid = null;
newevent.location = 'Pune';
insert newevent; 

  

 

Thanks in Advance.

 

 

Hi All,

 

     I have created a Rest API and return a string. i got stuck with a error message.

 

"URL No Longer Exists".

 

its will be great if anyone could help me on this.

 

 REST API Class

@RestResource(urlMapping= '/GetService/*')
global with sharing class getTarget
{
    @HttpGet
    global static String getRestMethod(RestRequest req,RestResponse res)
    {
        String name = req.params.get('name');
        return 'Hello'+name+', you have just invoked a custom Apex REST web service exposed using REST API' ;

    }
}

 

Apex Class

public class getService
{
    public string getname{get; set;}
    public string name{get; set;}
    
    public PageReference submit()
    {
        getname = getNameMethod(name);
        return null;
    }
    
    public static string getNameMethod(string name)
    {
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        req.setMethod('GET');
        string url = 'https://maheshch-developer-edition.my.salesforce.com/Services/apexrest/GetService?name='+name;
        req.setEndpoint(url);
        req.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
        HTTPResponse resp = http.send(req);
        return resp.getBody();
    }
    
 }

 

VF Page

<apex:page controller="getService">
    <apex:form >
        <apex:pageBlock >

        <apex:pageBlockSection >
               <apex:pageBlockSectionItem >
                    <apex:outputLabel for="name">Name</apex:outputLabel>
                    <apex:inputText id="name" value="{!name}"/>
               </apex:pageBlockSectionItem>
          </apex:pageBlockSection>
        </apex:pageBlock>

        <apex:commandButton action="{!submit}" value="Submit"> </apex:commandButton>
        <br/><br/>        {!getname}
    </apex:form>
</apex:page>

 

Thanks in advance..

 

Hi all,

 

I have define a Field Sets on Account object and in that i included fields list as Account name,Account ID,billing city and billing street.

 

Here comes the issue, when i wanted to display the Field Sets on Visualforce page. it is throwing error message

 

  
Unable to Access Page 
Invalid parameter value "" for parameter "id". 

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 
 
 

 

 

if i remove the Accountid from the Field Sets list. now its working fine.

 

is there any field set limitation with visualforce page?

 

could anyone have solution for this?

 

 

Hi All,

 

I am working on AD(Active Directory) integration with salesforce.com.

my application is developed using c# and asp.net. and while running it is redirecting to salesforce.com/login.jsp with two parameters like pw(as token) and username

 

On landing the salesforce.com login page it is giving error msg.

 

"Your company's authentication service is currently down".

 

it would be helpful for me if anyone can guide to solve the issue.

 

Thanks in advance.

MaheshC

 

 

 

 

 

 

 

 

I have created a new custom object as "Automobile__c"

 

for the same object i have created a page and a controller to insert new record in to the same.

 

Visualforce Page:

 

<apex:page Controller="VolunteerRegisterContr" > <apex:sectionHeader title="Customer Opportunity" subtitle="Step 1"/> <apex:form > <apex:pageBlock title="Customer Information" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Registration"/> <table> <tr><td> <apex:outputLabel >Name</apex:outputLabel></td><td> <apex:inputField id="accountName" value="{!auto.Last_Name__c}" required="false" /></td></tr> <tr><td><apex:outputLabel >Street</apex:outputLabel> </td><td> <apex:inputField id="accountSite" value="{!auto.Street__c}"/></td></tr> <tr><td> <apex:outputLabel >Organization Name</apex:outputLabel> </td><td><apex:inputField id="contactFirstName" value="{!auto.Organization__c}"/></td> </tr><tr><td> <apex:outputLabel >Education</apex:outputLabel> </td> <td> <apex:inputField id="contactLastName" value="{!auto.Education__c}"/></td></tr></table> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

Class

 

Public class VolunteerRegisterContr{ public ApexPages.StandardController controller; //Public Account acc{get; set;} Public Automobile__c auto{get; set;} Public String aName {get; set;} Public String aManufactureNamec {get; set;} Public String aLName {get; set;} Public String aStreet {get; set;} Public String aEdu {get; set;} public VolunteerRegisterContr(ApexPages.StandardController Controller) { auto=(Automobile__c)Controller.getRecord(); this.controller=Controller; } public VolunteerRegisterContr(){} public PageReference Save() { insert auto; return null; } }

 

 

 

 

 

 

Hi all,

 

 

I have create a force.com site in my developer instance and i have created a page assign as Active Site Home Page.

 

When i am browsing the site it is displaying the site. But when am click on save button it is not saving the new record.

 

Then i have given static values eventhough its not working.

 

can anyonce help me please.

 

Apex Cde:-

<apex:page controller="insertauto" showHeader="false"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" rerender="error"/> </apex:pageBlockButtons> <apex:pageBlockSection title="info" columns="1"> Name<apex:inputText value="{!autoname}"/> Manufacture <apex:inputText value="{!manufacture}"/> msg <apex:inputText value="{!msg}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 

Controller Class:

 

public with sharing class insertauto { public Automobile__c accts = new Automobile__c(); public String autoname {get; set;} public String manufacture {get; set;} public String msg{get; set;} public insertauto(){ } public void save(){ accts.Name='mahesh'; accts.Manufacture_Name__c='maruthi'; insert accts; } }

 

hi all,

i am in critical situation, as per client requirement i have written a class in sandbox. its working fine.

when it come to test coverage in eclipse. it was not giving more then 15% .

i want to give the whole code but blog is not supporting more the 20000 characters.

a sample of that code is in below.

Code:
global class LeadtoContactConversionClass{
WebService static String leadconvert(string id) {

Lead l = new Lead();
Contact c= new Contact();
Contact c_update=new Contact();
Contact c_create =new Contact();
Account a= new Account();
Contact_Commitment__c cust_Commit = new Contact_Commitment__c();
String str,strid='',FName='',LName='',fiscalyear='';
//strid=id;
Integer commit_val=0,ival=0,count_c=0;
string csi_tags,comm_sub,commit_name,info,csi_tag,commsub,lead_commsub,l_csi;
boolean ser_email;
Integer len_l,len_c;
string email1='',email2='';
Integer imon=0,iyear=0; 
//string id
//string id='00QT0000004S0y7';
 //Date date1;
l=[Select Address_type_1__c, Address_Type_2__c, City, City_1__c, City_2__c,Communications_Subscriptions__c, Company,Country, Country_1__c, Country_2__c, CreatedDate,CSI_Events_email_list__c, CSI_Tag__c, Description,Commitment_Type__c,Email, Email_1__c, Email_2__c, Email_2_type__c, email_type__c,Commitment_Comments__c,Commitment_Description__c,Commitment_Manager__c,commitment_name__c,Commitment_Role__c,Start_Date__c,End_Date__c, Event_2__c, Fax,Fax_2__c, FirstName, Forces_For_Good__c, HasOptedOutOfEmail, Id, Industry,Information_request__c, LastName, LeadSource, MobilePhone, Name, Phone,Phone_2__c, Phone_2_type__c, phone_type__c, PostalCode, Preferred_Address__c, RecordTypeId,Salutation, SER_email_list__c,State, State_2__c, State_Province_1__c, Status,Stage__c,Street, Street_Address__c, Street_Address_1__c, Street_Address_2__c, SUID__c, SystemModstamp, Title, Website,Zip_Code_2__c, Zip_Postal_Code_1__c from Lead where Id =:id];
//c=[Select Name,FirstName,LastName from Contact where Name=:l.name and (( Account.Name=:l.Company) or (Email=:l.Email or Email_2__c=:l.Email_2__c) or (Email=:l.Email_2__c or Email_2__c=:l.Email) )];
//l.adderror(c.name);
//count_c=[Select Count() from Contact where Name=:l.name and (( Account.Name=:l.Company) or(Email=:l.Email or Email_2__c=:l.Email_2__c) or (Email=:l.Email_2__c or Email_2__c=:l.Email) )];
info=l.Information_request__c;
csi_tags=l.CSI_Tag__c;
comm_sub=l.Communications_Subscriptions__c;
commit_name=l.commitment_name__c;
 //str=''+count_c;
date date1 = l.Start_Date__c;
//date date1 = Date.newInstance(l.Start_Date__c.year(),l.Start_Date__c.month(),l.Start_Date__c.day());//

s
if(commit_name!=null)
{
 
 //date date1 = l.Start_Date__c;
 imon =date1.month();             ---------- error is this line is not covered.
 iyear =date1.year();       ---------- error is this line is not covered.


}

 if(imon>8)  ---------- error is this line is not covered.

 {
  fiscalyear=''+(iyear+1); ---------- error is this line is not covered.

 
 }
 else
 {
  fiscalyear=''+iyear;
 }

 string l_commsub='',csi_events='',commsub_str;
 commsub_str=l.Communications_Subscriptions__c;
 if(l.LeadSource=='Online Registration')    ---------- error is this line is not covered.
 {
  if(commsub_str!=null)
  {
    l_commsub = l.Communications_Subscriptions__c+';CSI Newsletter';---------- error is this line is not covered.
  }
  else
  {
    l_commsub = 'CSI Newsletter'; 
  }
   csi_events='checked';
 } 
 else 
 {
   l_commsub = l.Communications_Subscriptions__c; ---------- error is this line is not covered.
   if(l.CSI_Events_email_list__c==true)
     {
    csi_events='checked';
   }

 }
}
...................
................... 



static testMethod void myTest()
 {
Integer commit_val=0,ival=0,count_c=0;
string csi_tags,comm_sub,commit_name,info,csi_tag,commsub,lead_commsub,l_csi;
boolean ser_email;
Integer len_l,len_c;
string email1='',email2='';
Integer imon=0,iyear=0; 

  Lead l1=new Lead();
  l1=[Select Id,FirstName,LastName from Lead where LastName=:'Test1'];
                imon=9;
  iyear=2008;
  leadsource='Online Registration';
  commsub_str='CSI Newsletter';
  l_commsub='CSI Newsletter';
  status='Open - Contacted';
  csinewslettertt=';CSI Newsletter';
  


  leadconvert(l1.Id); }
 
}  

in this class the test method is myTest(). the record of 'Test1' have all the field have full data.

for any  more clarification. my emaild 'chilakamahesh@gmail.com'.

 

thanks & regards,

Mahesh Chilaka.


 

hi all,

i am in critical situation, as per client requirement i have written a class in sandbox. its working fine.

when it come to test coverage in eclipse. it was not giving more then 15% .

i want to give the whole code but blog is not supporting more the 20000 characters.

a sample of that code is in below.

 

Code:
global class LeadtoContactConversionClass{
WebService static String leadconvert(string id) {

Lead l = new Lead();
Contact c= new Contact();
Contact c_update=new Contact();
Contact c_create =new Contact();
Account a= new Account();
Contact_Commitment__c cust_Commit = new Contact_Commitment__c();
String str,strid='',FName='',LName='',fiscalyear='';
//strid=id;
Integer commit_val=0,ival=0,count_c=0;
string csi_tags,comm_sub,commit_name,info,csi_tag,commsub,lead_commsub,l_csi;
boolean ser_email;
Integer len_l,len_c;
string email1='',email2='';
Integer imon=0,iyear=0; 
//string id
//string id='00QT0000004S0y7';
 //Date date1;
l=[Select Address_type_1__c, Address_Type_2__c, City, City_1__c, City_2__c,Communications_Subscriptions__c, Company,Country, Country_1__c, Country_2__c, CreatedDate,CSI_Events_email_list__c, CSI_Tag__c, Description,Commitment_Type__c,Email, Email_1__c, Email_2__c, Email_2_type__c, email_type__c,Commitment_Comments__c,Commitment_Description__c,Commitment_Manager__c,commitment_name__c,Commitment_Role__c,Start_Date__c,End_Date__c, Event_2__c, Fax,Fax_2__c, FirstName, Forces_For_Good__c, HasOptedOutOfEmail, Id, Industry,Information_request__c, LastName, LeadSource, MobilePhone, Name, Phone,Phone_2__c, Phone_2_type__c, phone_type__c, PostalCode, Preferred_Address__c, RecordTypeId,Salutation, SER_email_list__c,State, State_2__c, State_Province_1__c, Status,Stage__c,Street, Street_Address__c, Street_Address_1__c, Street_Address_2__c, SUID__c, SystemModstamp, Title, Website,Zip_Code_2__c, Zip_Postal_Code_1__c from Lead where Id =:id];
//c=[Select Name,FirstName,LastName from Contact where Name=:l.name and (( Account.Name=:l.Company) or (Email=:l.Email or Email_2__c=:l.Email_2__c) or (Email=:l.Email_2__c or Email_2__c=:l.Email) )];
//l.adderror(c.name);
//count_c=[Select Count() from Contact where Name=:l.name and (( Account.Name=:l.Company) or(Email=:l.Email or Email_2__c=:l.Email_2__c) or (Email=:l.Email_2__c or Email_2__c=:l.Email) )];
info=l.Information_request__c;
csi_tags=l.CSI_Tag__c;
comm_sub=l.Communications_Subscriptions__c;
commit_name=l.commitment_name__c;
 //str=''+count_c;
date date1 = l.Start_Date__c;
//date date1 = Date.newInstance(l.Start_Date__c.year(),l.Start_Date__c.month(),l.Start_Date__c.day());//

s
if(commit_name!=null)
{
 
 //date date1 = l.Start_Date__c;
 imon =date1.month();             ---------- error is this line is not covered.
 iyear =date1.year();       ---------- error is this line is not covered.


}

 if(imon>8)  ---------- error is this line is not covered.

 {
  fiscalyear=''+(iyear+1); ---------- error is this line is not covered.

 
 }
 else
 {
  fiscalyear=''+iyear;
 }

 string l_commsub='',csi_events='',commsub_str;
 commsub_str=l.Communications_Subscriptions__c;
 if(l.LeadSource=='Online Registration')    ---------- error is this line is not covered.
 {
  if(commsub_str!=null)
  {
    l_commsub = l.Communications_Subscriptions__c+';CSI Newsletter';---------- error is this line is not covered.
  }
  else
  {
    l_commsub = 'CSI Newsletter'; 
  }
   csi_events='checked';
 } 
 else 
 {
   l_commsub = l.Communications_Subscriptions__c; ---------- error is this line is not covered.
   if(l.CSI_Events_email_list__c==true)
     {
    csi_events='checked';
   }

 }
}
...................
................... 



static testMethod void myTest()
 {
  Lead l1=new Lead();
  l1=[Select Id,FirstName,LastName from Lead where LastName=:'Test1'];
  
  leadconvert(l1.Id); }
 
}  


 in this class the test method is myTest(). the record of 'Test1' have all the field have full data.

for any  more clarification. my emaild 'chilakamahesh@gmail.com'.

 

thanks & regards,

Mahesh Chilaka.

hi all,
 
i have written a class in eclipse 3.3x and i want to deploy into production.
 
for that i have tested the code ,but i that code it is giving error.
 
 
      -:the code is in below:-
 
lead l=new lead();
 
l=[Select id,Start_date__c from lead where lastname=:'test1'];
 
date date1=l.Start_date__c;
 
Integer imon=date1.month();       ------------- here it is giving error
 
 
 
 
pls help me to solve the issue. and give me the suggestion for how to get month value to an integer variable.
 
 
 
Thanks & Regards
Mahesh Chilaka
 
 
 
 
 
 
 
 

 

hi all,

i have writtern a apex class for leadconvertion.

when i tested class in eclipse editor it is showing 0% test coverage.

what should i do to solve this issue.

i need any of ur help to deploy to production.

how to write "test method" for this apex class. whether i have to write test method in the same apex class or different class.

Hi All,
 
I have existing picklist which contains 100 values and i have text field in an a standard object.
 
i want to compare all values (not the vaue which is selected in a picklist) in  a picklist with text field using trigger.
 
 
please help me in this issue......
 
 
thanks in advance.
Mahesh Chilaka:smileyhappy:
 
Hi,
 
Can anybody help me in addressing the following error..
 
when i am trying to deploy a trigger from sandbox to production instance using Eclipse 3.3.1.1 i am getting "Null pointer : Exception error".
 
But the same trigger i am able to deploy from sandbox to developer instance with out any error..
 
I am using API 11.1 version..and eclipse 3.3.1.1 
 
Thanks in advance!!!
 

Hi,
I want to copy one existing report from one folder to another. Is it to export the original one first? If yes, how can we further capture the exported source into one other folder? Can I have the details of this?

 

Many Thanks & Best Regards,
Edward Chan

Hi All,

 

i have one object Opportunity. i have three other obejcts object1, object2, object3, these objects have realationship with opportunity (parent or child relaitonship). can we know dynamically these objects having which realtiohship with opportunity. whether it has child realtionship or parent relationship with opportunity.

 

Thanks

Praveen

Hi,

 

I wanted to know if anyone has come up with a solution to show parent to child contact list.  When I am at a parent account I would like to see a section for all clinic accounts and their associated contacts.  Please let me know if you need further explanation or if you have a solution.

 

Thanks,

Bennett Tran

  • March 26, 2013
  • Like
  • 0

How can I get the Name, Company, Phone Website and the description from the last (Most recent) 2 Task associated with the Lead. I do need all of the leads so Querying the Task Table and using Who does not work for me. 

 

I tried 

SELECT Id, Name, FirstName, LastName, Company, Website, Phone, (SELECT Description FROM Task limit 1 ) FROM Lead

 

Didn't understand relationship 'Task' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

 

How do you relate these two tables?

 

Hi All,

 

Sure this is a syntax problem, but cant get my head around it:

 

{!REQUIRESCRIPT("/soap/ajax/18.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/18.0/apex.js")} 

var connection =sforce.connection; 
var CA = "{!CMC__c.DEBUG_ofCompletedAssessments__c}";
var User = "{!$User.Full_Name__c}",
var CR = "{!CMC__c.Case_Reason__c}",
var URL = "{!CMC__c.UAT_QAT_Zoomerang_URL__c}",

IF( 
                AND( 
                                CA <1, 
                                OR( 
                                                CR = "New Script QAT", 
                                                CR = "New Script UAT"
                                  )
                                )
                { 
                                window.open('URL');
                }
)
else{
alert("Either an Assessment is not applicable for this case, or you are not authorised to complete assessments");
}

 

 

 I get 'Unexpected Identifier' when clicking?

 

Any help appreciated.

Hi All,

 

I wrote a trigger on event object (before insert/update events).

its working fine when i create or edit the record , but it fails when i update the event startdate through calendar (ie changing the time of the event ). 

The trigger is not invoked.

 

Could you please suggest me.

 

Thanks in advance.

 

 

 

How To Find Total Code Coverage in Eclipse %

Hello Cloud Experts!  I have a situation and can't seem to find the answer.

 

I have a parent & child object (many childs to parent possible via related list).  On the child record, I'm capturing information like:

 

-Start Date

-End Date

-Monthly Payment

 

On any given parent record, I would like to capture the last 12 month's average payment.  I could do this via roll up summary fields (sum/count) but the problem I have is:  I may not have the last consecutive 12 months worth of data.

 

For example, 

 

Scenario 1) Today is June 2011, I would like to see the average of the latest data set I have (June 2010 --> June 2011).   This is doable with roll up summary fields & date filters.

 

Secnario 2) Today is June 2011, but the last 12 months worth of data I have is from (February 2010 --> Feb 2011).  How do I calculate this?  Almost like a rolling/moving 12 month average.  

 

Any creative approach to this? 

 

Thanks in advance for your time and help.  Cheers!

 

 

Hi,

I am new to salesforce.com apex. I have enabled product scheduling for opportunities. I have created another object where I want to populate the schedule amount and the date.

 

Can anyone please tell me how can I do this. I have a date field & amount filed on the new object [ Revenue Schedule] . All i want to do is write the revenue schedule amount to amount  & Schedule date to date.

 

PLease suggest.

 

Thanks.

What is the difference between the apex class & components ?

Why to use components & as i feel that entire reusability things can also be achieved by the apex class ?

Hi

I have a problem poppulate Field.

Email_Subject__c = Subject At before insert and subject = null

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger ChangeEmail caused an unexpected exception, contact your administrator: ChangeEmail: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.ChangeEmail: line 13, column 52

 

trigger ChangeEmail on Case(before insert) {
   
   
    Set<Id> CaseIDs = new Set<Id>();
            
    for (Case COT: trigger.new) {
        CaseIDs.add(COT.id);
    }        
     Map<Id, Case> pSale = new Map<Id, Case>([SELECT a.id, a.Email_Subject__c,a.Subject FROM Case a WHERE a.id IN :CaseIDs]);
                                                         
   for(Case fcon : Trigger.New){
   if(fcon.Origin == 'Email'){
        fcon.Email_Subject__c = pSale.get(fcon.id).Subject;
        }
   }
    

}

 

Thank you

 

 

  • May 18, 2011
  • Like
  • 0

Hi ,

 

I have a controller through which i want to display all the fields in a page.My method "surveyform" is not working.I want to display all the fields value so that a user can input some value in it and save it.

 

 

<apex:page standardController="Case" extensions="Survey" sidebar="false">
 <apex:form style="background-color:#FFFFFF;"> 
    <style type="text/css">
        body {font-family:Arial Unicode MS;font-size:12px;}
        P{background-color:#006400;HEIGHT:20PX;font-size:12px;font-weight:bold;color:#FFFFFF;}
    </style>

 <apex:pageBlock title="Survey Form">
 <apex:pageBlockSection title="Please enter the details" collapsible="true"  columns="2" showHeader="true" 

onmouseover="hover">
  <apex:dataTable value="{!surveyform}" var="line"  width="50%">
 <apex:column >
 <apex:outputText value="Survey Name:" style="width:50px"/><br/>
 <apex:outputText value="How was the Case handling power:" style="width:50px"/><br/>
 <apex:outputText value="How was the feedback:" style="width:50px"/><br/>
 <apex:outputText value="Case:" style="width:50px"/><br/>
 </apex:column>
 <apex:column >
 <apex:inputField value="{!line.Name}"/><br/>
 <apex:inputField value="{!line.How_was_the_Case_handling_power__c}"/><br/>
 <apex:inputField value="{!line.How_was_the_feedback__c}"/><br/>
 <apex:outputField value="{!line.Case__c}"/><br/>
 </apex:column>

 
 </apex:dataTable>
 </apex:pageBlockSection>
 <center><apex:commandButton value="Save" action="{!Survey}"/>
 <apex:commandButton value="Cancel" action="{!Cancel}"/> </center>
 </apex:pageBlock> 

 </apex:form> 
</apex:page>
                  

 

 

My Controller

 

public  class Survey {

  public List<Survey__c> sur{get;set;}
  public Id srid;
  public Case cs;
  public Id cid;
  public ApexPages.StandardController a;

     public Survey(ApexPages.StandardController
                                      stdController) {
       cs = (Case)stdController.getRecord();
       system.debug('menon:'+ cs);
       a = stdController;
       cid = a.getRecord().id;
       system.debug('Survey:'+ cid);
         }
         
         
     public List<Survey__c> getSurveyform() {
         sur= [Select Name,How_was_the_Case_handling_power__c,How_was_the_feedback__c,Case__c from Survey__c where Case__c=:cid ];
         System.debug('sana:' + sur);
       
       
         return sur;
          }
    
     Public PageReference Survey(){
     insert(sur);
     return null;
          }
       
}

 

 

  • April 28, 2011
  • Like
  • 0

Hi everyone,

 

i want to export data to excel using vfpage.

So i did like this.i put the content type as  folllows.its working fine.

<apex:page standardcontroller="Quote" contentType="application/vnd.ms-excel" cache="true">
  <apex:pageBlock title="Quotes">
      <apex:pageBlockTable value="{!Quote}" var="q">
         <apex:column />
         <apex:column value="{!q.id}"/>
         <apex:column value="{!q.Name}"/>
         <apex:column value="{!q.Subtotal}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
 
</apex:page>

 

Currently the filename of the excel and sheet name is my vfpage name-ExportQuotes.But if i want to display the products also in the same file but as different sheet.ie:Quote in Sheet1  and QuoteLine Items in Sheet2 in same page.is it posible.Can anyone help me on this?Its urgent.........

  • April 28, 2011
  • Like
  • 0

this is my apex class:

public class guideddata{
public ID id;
public GE_PW_User_Sales_Hierarchy_Association__c g;
public ID urluser{get;set;}
public User manager{get;set;}
public user mgr{get;set;}
public user usr{get;set;}
public string own{get;set;}
public List<SelectOption> locationlist{get;set;}
public string loc{get;set;}
public List<selectoption> sel{get;set;}
public string flag;
public Boolean shouldRender{get;set;}
public list<GE_PW_User_Sales_Hierarchy_Association__c> Managerlocationid = new List<GE_PW_User_Sales_Hierarchy_Association__c>();
public list<GE_PW_User_Sales_Hierarchy_Association__c> Userlocationid = new List<GE_PW_User_Sales_Hierarchy_Association__c>();
public list<GE_PW_User_Sales_Hierarchy_Association__c> loclist= new list<GE_PW_User_Sales_Hierarchy_Association__c>();
public GE_PW_User_Sales_Hierarchy_Association__c sec = new GE_PW_User_Sales_Hierarchy_Association__c();
public GE_PW_User_Sales_Hierarchy_Association__c assignuser = new GE_PW_User_Sales_Hierarchy_Association__c();
public GE_PW_User_Sales_Hierarchy_Association__c pcklst = new GE_PW_User_Sales_Hierarchy_Association__c();
public list<GE_PW_User_Sales_Hierarchy_Association__c> lst = new list<GE_PW_User_Sales_Hierarchy_Association__c>();
public GE_PW_User_Sales_Hierarchy_Association__c Parentleveltype = new GE_PW_User_Sales_Hierarchy_Association__c();
public GE_PW_User_Sales_Hierarchy_Association__c fields = new GE_PW_User_Sales_Hierarchy_Association__c();
public list<GE_PW_User_Sales_Hierarchy_Association__c> locid = new list<GE_PW_User_Sales_Hierarchy_Association__c>();
public list<GE_PW_User_Sales_Hierarchy_Association__c> seclocationid = new list<GE_PW_User_Sales_Hierarchy_Association__c>();

 

public id locsfid;

public guideddata(ApexPages.StandardController controller)
{
id=System.currentPageReference().getParameters().get('userid');

manager=[select managerid from user where id=:id];
if(manager.managerId!=null)
{
mgr=[Select Name from User where id=:manager.managerId];
String s=mgr.Name;
}
usr=[select name from User where id=:id];
string l=usr.name;
locsfid=System.currentPageReference().getParameters().get('locsfid');

//Parentleveltype=[select GE_PW_Location_Level_Name__c from GE_PW_User_Sales_Hierarchy_Association__c where GE_PW_User_ID__c=:manager.managerid and GE_PW_Primary_OwnerShip_Flag__c= 'YES' limit 1];
Managerlocationid=[Select GE_PW_Location_ID__c from GE_PW_User_Sales_Hierarchy_Association__c where GE_PW_User_ID__c=:manager.managerid and GE_PW_Primary_OwnerShip_Flag__c= 'YES'];
Userlocationid=[select id,GE_PW_Location_ID__c from GE_PW_User_Sales_Hierarchy_Association__c where GE_PW_User_ID__c=:id and GE_PW_Primary_OwnerShip_Flag__c= 'YES'];

locationlist = new List<SelectOption>();

for(GE_PW_User_Sales_Hierarchy_Association__c m:Managerlocationid)
{
loclist.add(m);
}
for(GE_PW_User_Sales_Hierarchy_Association__c u:Userlocationid)
{
loclist.add(u);
}

for(GE_PW_User_Sales_Hierarchy_Association__c h:loclist)
{
if(h.GE_PW_Location_ID__c!=null)
{
locationlist.add(new selectoption(h.id,h.GE_PW_Location_ID__c));
}
}

sel=new List<SelectOption>();
sel.add(new SelectOption('', '--None--'));
sel.add(new SelectOption('Ownership', 'Ownership'));
sel.add(new SelectOption('Visibility', 'Visibility'));


this.g = (GE_PW_User_Sales_Hierarchy_Association__c)controller.getRecord();
this.g.GE_PW_Location_Level_Name__c = ApexPages.currentpage().getParameters().get('SapIDType');
this.g.GE_PW_Location_ID__c = ApexPages.currentpage().getParameters().get('SapID');
loc= ApexPages.currentpage().getParameters().get('owner');
}

public void doDisable() {
  if (loc == 'Visibility') {
    shouldRender = false;
  } else if(loc == 'Ownership'){
    shouldRender = true;
  }
}

public PageReference back()
{
PageReference NewPage=new PageReference('/apex/ManageLocationid?id='+id);
 NewPage.setRedirect(true);
   return NewPage;
}     
 
public PageReference save()
{
lst=[select GE_PW_Parent_Location_ID__c from GE_PW_User_Sales_Hierarchy_Association__c where GE_PW_User_ID__c=:id and GE_PW_Primary_OwnerShip_Flag__c='YES' limit 1];
locid=[select id from GE_PW_User_Sales_Hierarchy_Association__c where GE_PW_Location_ID__c=:g.GE_PW_Location_ID__c and GE_PW_Primary_Ownership_Flag__c='YES'];
if(locid.size()>0)
{
fields=[select GE_PW_Parent_Location_ID__c,GE_PW_Parent_Location_Level_Name__c from GE_PW_User_Sales_Hierarchy_Association__c where id=:locid limit 1];
}
if(shouldRender==true && own!=null)
{
pcklst=[select GE_PW_Location_ID__c,GE_PW_Location_Level_Name__c from GE_PW_User_Sales_Hierarchy_Association__c where id=:own];
}
if(loc=='Ownership')
{
flag='YES';
}
else if(loc=='Visibility')
{
flag='NO';
}
if(g.GE_PW_Location_Level_Name__c!=null && g.GE_PW_Location_ID__c!=null && loc!=null )
 
{
if(locsfid!=null)
{
sec=[select GE_PW_Location_Level_Name__c,GE_PW_Location_ID__c,GE_PW_Primary_OwnerShip_Flag__c,GE_PW_Parent_Location_ID__c,GE_PW_Parent_Location_Level_Name__c from GE_PW_User_Sales_Hierarchy_Association__c where id=:locsfid ];
sec.GE_PW_Location_Level_Name__c = g.GE_PW_Location_Level_Name__c;
sec.GE_PW_Location_ID__c = g.GE_PW_Location_ID__c;
sec.GE_PW_Primary_OwnerShip_Flag__c = flag;
system.debug('len:'+shouldRender);
if(shouldRender==true && own!=null)
{
sec.GE_PW_Parent_Location_ID__c = pcklst.GE_PW_Location_ID__c;
sec.GE_PW_Parent_Location_Level_Name__c=pcklst.GE_PW_Location_Level_Name__c;
}
else if(shouldRender==false)
{system.debug('inside');
//sec.GE_PW_Parent_Location_ID__c = lst[0].GE_PW_Parent_Location_ID__c;
//system.debug('Parent:'+lst[0].GE_PW_Parent_Location_ID__c  );
//sec.GE_PW_Parent_Location_Level_Name__c=Parentleveltype.GE_PW_Location_Level_Name__c;
if(locid.size()>0)
{
sec.GE_PW_Parent_Location_ID__c = fields.GE_PW_Parent_Location_ID__c;
sec.GE_PW_Parent_Location_Level_Name__c=fields.GE_PW_Parent_Location_Level_Name__c;
}
else
{
sec.GE_PW_Parent_Location_ID__c = 'NO';
sec.GE_PW_Parent_Location_Level_Name__c='NO';
}


}
update sec;
}
else
{
assignuser.GE_PW_Location_Level_Name__c= g.GE_PW_Location_Level_Name__c;
assignuser.GE_PW_Location_ID__c = g.GE_PW_Location_ID__c;
assignuser.GE_PW_Primary_OwnerShip_Flag__c = flag;
assignuser.GE_PW_User_ID__c=id;
if(shouldRender==true && own!=null)
{
assignuser.GE_PW_Parent_Location_ID__c=pcklst.GE_PW_Location_ID__c;
assignuser.GE_PW_Parent_Location_Level_Name__c=pcklst.GE_PW_Location_Level_Name__c;
}
else if(shouldRender==false)
{
//assignuser.GE_PW_Parent_Location_ID__c=lst[0].GE_PW_Parent_Location_ID__c;
//assignuser.GE_PW_Parent_Location_Level_Name__c=Parentleveltype.GE_PW_Location_Level_Name__c;
if(locid.size()>0)
{
assignuser.GE_PW_Parent_Location_ID__c=fields.GE_PW_Parent_Location_ID__c;
assignuser.GE_PW_Parent_Location_Level_Name__c=fields.GE_PW_Parent_Location_Level_Name__c;
}
else
{
assignuser.GE_PW_Parent_Location_ID__c='NO';
assignuser.GE_PW_Parent_Location_Level_Name__c='NO';
}
}
insert assignuser;
}
}
else
{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter values for all fields.'));
            return null;
}

PageReference NewPage=new PageReference('/apex/ManageLocationid?id='+id);
NewPage.setRedirect(true);
return Newpage;

 

}
}

 

  • April 28, 2011
  • Like
  • 0

Hi all,

 

I tried to test my Controller Extensions, but it didn't work.

 

Here is VF page whose name is "pageName". 

<apex:page standardController="User" extensions="userExtension2" sidebar="false">
<apex:pageMessages showDetail="true" />
 <apex:sectionHeader title="AAA" subtitle="{!$User.LastName} {!$User.FirstName}"></apex:sectionHeader>
    <apex:form >
        <apex:pageBlock title="BBB">
            <apex:pageBlockButtons>
                <apex:commandButton action="{!save}" value="save"></apex:commandButton>
                <apex:commandButton action="{!cancel}" value="cancel"></apex:commandButton>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="CCC" collapsible="false" columns="1">
                <apex:inputField value="{!User.testField1__c}"></apex:inputField>
                <apex:inputField value="{!User.testField2__c}"></apex:inputField>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 Here is Controller Extensions.

public class userExtension2 {
        private final User u;
               
        public userExtension2(ApexPages.StandardController stdController) {                
           this.u = (User)stdController.getRecord();
           
        }
        
        public PageReference save() {
           if(u.testField1__c != null && u.testField1__c.length() > 0)
           {
              if(u.testField2__c != null && u.testField2__c.length() > 0)
              {
                 User us = [select testField1__c,testField2__c  from User where Id = :UserInfo.getUserId()];
                                 
                 us.testField1__c = u.testField1__c;
                 us.testField2__c = u.testField2__c;
                 
                 try {
                    //update
                    update us;
                    ApexPages.addMessage(new ApexPages.Message( ApexPages.severity.INFO, 'COMPLETE','COMPLETE'));
                 } catch (DmlException e) {
                    ApexPages.addMessage(new ApexPages.Message( ApexPages.severity.ERROR, 'ERROR','ERROR'));
                 }           
              }
              else
              {
                 ApexPages.addMessage(new ApexPages.Message( ApexPages.severity.ERROR, 'ERROR','ERROR'));
              }
           }
           else
           {
              ApexPages.addMessage(new ApexPages.Message( ApexPages.severity.ERROR, 'ERROR','ERROR'));
           }
           return null;     
        }
}

 

Here is Test Class.

public class userExtension2Tests {
   
   public static testMethod void testMyController() {
   
      PageReference pageRef = Page.pageName;
      Test.setCurrentPage(pageRef);
      
      User thisUser = [select testField1__c,testField2__c  from User where Id = :UserInfo.getUserId()];
      
      ApexPages.StandardController sc = new ApexPages.StandardController(thisUser);
      userExtension2 controller = new userExtension2(sc);
      
      String nextPage = controller.save().getUrl();
      System.assertEquals('/apex/pageName', nextPage);
      
      thisUser.testField1__c ='test12345@jp.fujitsu.com';
      thisUser.testField2__c = 'sample';
      nextPage = controller.save().getUrl();
      
      System.assertEquals('/apex/pageName', nextPage);
      
      User saveUser = [select testField1__c,testField2__c  from User where Id = :UserInfo.getUserId()];
      System.assertEquals('test12345@jp.fujitsu.com', saveUser.testField1__c);
      System.assertEquals('sample', saveUser.testField2__c);
   }
}

 

Here is Test Failures:

- Message is "System.NullPointerException: Attempt to de-reference a null object".

- Stack Trace is "Class.userExtension2Tests.testMyController: line 13, column 25 External entry point".

 

 

I am recieving the following error when I click a custom button that customizes the new button.

 

Error

 

A problem with the OnClick JavaScript for this button or link was encountered:

sforce is not defined

 

 

Custom Button - List Button - Execute JavaScript - OnClick JavaScript

 

 

var MPS__c = sforce.sObject("MPS");
var id = sforce.apex.execute("NewMPSGlobal","makeMPS",
                             {MPS_Scheduled_Ship_Date__c: Opportunity.Projected_Ship_Date__c,
                              o:opportunity});

 

Apex Class:

 

 

global class NewMPSGlobal { 
  webService static Id makeMPS( Opportunity o) { 
        MPS__c mps = new MPS__c(MPS_Scheduled_Ship_Date__c= o.Projected_Ship_Date__c, Opportunity__c = o.Id); 
        return mps.id; 
    }
}

 

 

How do I solve the error?

 

Thank you

 

Hi all,

 

I have define a Field Sets on Account object and in that i included fields list as Account name,Account ID,billing city and billing street.

 

Here comes the issue, when i wanted to display the Field Sets on Visualforce page. it is throwing error message

 

  
Unable to Access Page 
Invalid parameter value "" for parameter "id". 

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 
 
 

 

 

if i remove the Accountid from the Field Sets list. now its working fine.

 

is there any field set limitation with visualforce page?

 

could anyone have solution for this?

 

 

Hi I am trying to create a trigger to update the check box whenever the Opportunity stage changes from Closed Won to a new stage. Here is the trigger i wrote and it is throwing me an error. Please let me know whether the way i wrote the trigger is write or wrong. I mentioned the error in Red color 

 

 

trigger OpportunityUpdate on Opportunity (after update)
{
List <Opportunity> OppList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
    if (Trigger.old[i].StageName == 'Closed Won' && Trigger.new[i].StageName != 'Closed Won')
        
        oppIdList.add(Trigger.new[i].Id);
}   
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where opportunity  :oppIdList];
if (OppList.size() > 0)
{
  
        if (Opportunity.Not_Closed_won__c != true)
        {
           Opportunity.Not_Closed_won__c = true;  
           }
    }
    
    update OppList;
    }

 

Hi, Experts - I got account and contact records into a sandbox and saved old ID values as in external / legacy fields for both objects. Question: using data loader how can I go about re-establish relations between account and contact utilizing external / legacy fields ? I did not want to work with csv files - thought data loader or any other API way I could do this ....help is appreciated, thank you.

I have created a new custom object as "Automobile__c"

 

for the same object i have created a page and a controller to insert new record in to the same.

 

Visualforce Page:

 

<apex:page Controller="VolunteerRegisterContr" > <apex:sectionHeader title="Customer Opportunity" subtitle="Step 1"/> <apex:form > <apex:pageBlock title="Customer Information" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Registration"/> <table> <tr><td> <apex:outputLabel >Name</apex:outputLabel></td><td> <apex:inputField id="accountName" value="{!auto.Last_Name__c}" required="false" /></td></tr> <tr><td><apex:outputLabel >Street</apex:outputLabel> </td><td> <apex:inputField id="accountSite" value="{!auto.Street__c}"/></td></tr> <tr><td> <apex:outputLabel >Organization Name</apex:outputLabel> </td><td><apex:inputField id="contactFirstName" value="{!auto.Organization__c}"/></td> </tr><tr><td> <apex:outputLabel >Education</apex:outputLabel> </td> <td> <apex:inputField id="contactLastName" value="{!auto.Education__c}"/></td></tr></table> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

Class

 

Public class VolunteerRegisterContr{ public ApexPages.StandardController controller; //Public Account acc{get; set;} Public Automobile__c auto{get; set;} Public String aName {get; set;} Public String aManufactureNamec {get; set;} Public String aLName {get; set;} Public String aStreet {get; set;} Public String aEdu {get; set;} public VolunteerRegisterContr(ApexPages.StandardController Controller) { auto=(Automobile__c)Controller.getRecord(); this.controller=Controller; } public VolunteerRegisterContr(){} public PageReference Save() { insert auto; return null; } }