• Coder
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 34
    Questions
  • 23
    Replies

Hi,

 

I have 3 fileds.start date(text),end date(text) and student status[picklist(values are trial,active,paid)].here my condition is if the end date is greater than 3days of start date and if the student status is "trial" then i want to delete those records.

 

In my code it is not checking the dates,it deletes entire trial records.Plz tell me modifications on my code.

Here is my code..

 

trigger expiry on chiranjeevi__Obj_D__c (before insert,before update)
 {
  List<chiranjeevi__Obj_D__c> objdlist=new List<chiranjeevi__Obj_D__c>();
  for(chiranjeevi__Obj_D__c a : Trigger.new)
  {
   objdlist=[SELECT chiranjeevi__startdate__c,chiranjeevi__enddate__c ,chiranjeevi__student_status__c from chiranjeevi__Obj_D__c WHERE chiranjeevi__student_status__c='trial']; 
    
    if(a.chiranjeevi__enddate__c > a.chiranjeevi__startdate__c.addDays(3) ) 
       {   
         delete objdlist;
       }  
   
 }
}

 

 

plz tell me how to check the date fileds.

 

Thanks in advance,

Manu..

  • June 17, 2010
  • Like
  • 0

Hi All,

 

I am new to triggers.I have 2 date fileds.

1.First_Logged_On_ Date__c,

2.Course_Expiry_Date__c.

Here i want to check check if the second date filed is greater than 3 days with compare to first date filed then i want to delete the record,

 

Plz tell me..

Thanks in advance,

Manu..

  • June 15, 2010
  • Like
  • 0

Hi All,

 

I am waiting for VMforce.In Which fall is it going to released.If any one knows please tell me.

 

Thanks

  • June 08, 2010
  • Like
  • 0

Hi,

 

I'm unable to get the results for the search. I have a custom object i'm storing  the customer details and i'm searching the record based on customer email id. I have written a apex class for that when i click on Save button i'm getting the error message as:

 

Error: Compile Error: SObject constructor must use name=value pairs at line 35 column 27

 

 

public class SearchCustomer { public SearchCustomer(ApexPages.StandardController controller) { } public List<Customer__c> results = new List<Customer__c>(); public List<Customer__c> customers { get; set; } String email; /* ------------ Getter and Setter for Email -------------------- */ public string getEmail() { return email; } public void setEmail(string email) { this.email = email; } public List<Customer__c> search() { customers = new List<Customer__c>(); for(Customer__c c:[SELECT Id,Email__c FROM Customer__c WHERE Email__c =: email]) { customers.add(new Customer__c(c)); } return null; } public List<Customer__c> getresults() { return customers; } /* public class Customer__c { public Customer__c cust { get; set; } public Customer__c(Customer__c c) { cust = c; } }*/ }

 

 

 

 Can any one able to solve this.

 

Thank you.

 

  • March 18, 2010
  • Like
  • 0

Hi,

 

I'm having problem with displaying google maps in visualforce page. Here its not taking the body onload function in visualforce page. i tried a example in that when i add the maps using the body onload() its not getting displayed, but when i call the unload function on button click i'm able to display the map.

 

Now, i want to display the map on onLoad() function.

 

 

<apex:page standardController="Contact" extensions="ContactSearch1"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google Maps API Sample</title> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAAiEBi5EXD6nh-EO4LuyxtBQWey-B1ZKQhVHInL6_tETDfQStQxR6nhjXEiIksVJNl42THPBptibDMw"></script> <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); } } </script> </head> <body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <input type="button" value="Show Map" Onclick="initialize()"> //When i click on the button i'm able to displayy the map in Visualforce page.... </body> </html> </apex:page>

 

 

Please help me to load the maps on visualforce page loads.

 

Thank You.

 

 

  • March 17, 2010
  • Like
  • 0

Hi,

 

Did anyone integrated Adobe BusinessCatalyst to Salesforce.com? Can i get the documentation for integrating BusinessCatalyst to Salesforce.com.

  • March 11, 2010
  • Like
  • 0

Hi,

 

I'm creating a visualforce page for searching the Contact Names from contact records. I can able to search the records and display it in visualforce page. But when i added the pagination functionality its not working in these page. Am i missing anything or my approach is wrong. Please help me to solve this problem.

 

 

Visualforce Page code...

 

 

<apex:page standardController="Contact" extensions="ContactSearch" showHeader="false" sidebar="false"> <apex:form > <apex:sectionHeader title="Search Contacts"/> <apex:pageBlock > <apex:pageBlockSection title="Contacts"> </apex:pageBlockSection> <!--Panel grid to get the input from users --> <apex:panelGrid columns="2"> <apex:outputLabel style="font-weight:bold;" value="Contact Name"></apex:outputLabel> <apex:inputtext value="{!inp}"/> <apex:outputLabel style="font-weight:bold;" value="Contact Email"></apex:outputLabel> <apex:inputText value="{!emailinp}"/> <apex:OutputLabel value="Select Lead Source" style="font-weight:bold;"/> <apex:selectList value="{!lsource}" size="1"> <apex:selectOptions value="{!Source}"></apex:selectOptions> </apex:selectList> </apex:panelGrid> <apex:commandButton value="Search" action="{!search}"/> <apex:pageBlockSection title="Search results" columns="1"> <apex:outputPanel id="contacts"></apex:outputPanel> <apex:pageBlockTable value="{!results}" var="contactsList"> <!--<apex:column> <apex:facet name="header"></apex:facet> </apex:Column>--> <apex:column headerValue="Contact First Name"> <apex:outputText value="{!contactsList.cont.Name}"/> </apex:column> <apex:column headerValue="Contact Email"> <apex:outputText value="{!contactsList.cont.Email}"/> </apex:column> <apex:column headerValue="Level"> <apex:outputText value="{!contactsList.cont.Level__c}"/> </apex:column> <apex:column headerValue="Lead Source"> <apex:outputText value="{!contactsList.cont.LeadSource}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> <apex:panelGrid columns="4"> <apex:commandLink action="{!first}">First</apex:commandlink> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink> <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink> <apex:commandLink action="{!last}">Last</apex:commandlink> </apex:panelGrid> </apex:form> </apex:page>

 

 Apex Class code.....

 

 In these apex class i'm not able to modify the Controllers Database.getQuerylocator. Now, when i click the search button in visuaforce page it will displays the record, but i want to give the pagination for that records.

public class ContactSearch { //List<categoryWrapper> categories {get; set;} public ContactSearch(ApexPages.StandardController controller) { cid = System.currentPageReference().getParameters().get('id'); } Public ApexPages.StandardSetController con { get { if(con == null) { con = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id, Name FROM Contact ORDER BY Name LIMIT 50])); con.setPageSize(5); } return con; } set; } /*Public List<categoryWrapper> getCategories() { categories = new List<categoryWrapper>(); return categories; } */ Public String cid; String inp; String emailinp; String leadsource; String lsource; String Source; public List<Contact> results = new List<Contact>(); public List<sContact> contacts { get; set; } Public Boolean hasNext { get { return con.gethasNext(); } set; } Public Boolean hasPrevious { get { return con.gethasPrevious(); } set; } Public integer pageNumber { get { return con.getpageNumber(); } } public void first() { con.first(); } public void last() { con.last(); } public void previous() { con.previous(); } public void next() { con.next(); } /* Getting the input from the user in the contact name text box and the values are assigned here */ public String getinp() { return inp; } public void setinp(String i) { this.inp = i; } /* -------------------------------------------------- */ /* Getting and Setting the input from the user in the contact email and the values are assigned here */ public String getemailinp() { return emailinp; } public void setemailinp(String email) { this.emailinp = email; } /* ------------------------------------------------------------------------ */ /* Getting and setting the values from the user in the lead source */ public string getleadsource() { return leadsource; } public void setleadsource(String ls) { this.leadsource = ls; } /* ------------------------------------------------------------------------ */ /* Getter and Setter value for Select List */ public string getlsource() { return lsource; } public void setlsource(String lsource) { this.lsource = lsource; } /* ------------------------------------------------------------------------------ */ /* */ public List<selectOption> getSource() { List<selectOption> val = new List<selectOption>(); val.add(new selectOption('','--None--')); val.add(new selectOption('Partner','Partner')); val.add(new selectOption('Web','Web')); val.add(new selectOption('Phone Inquiry','Phone Inquiry')); val.add(new selectOption('Partner Referral','Partner Referral')); val.add(new selectOption('Purchased List','Purchased List')); return val; } public void setSource(String source) { this.Source = source; } public List<contact> search() { contacts = new List<sContact>(); if(lsource!=null) { for(Contact c : [SELECT Name, FirstName, LastName, Email, Level__c, LeadSource, Id FROM Contact WHERE Name LIKE :inp+'%' AND Email LIKE :emailinp+'%' AND LeadSource LIKE:lsource+'%' ORDER BY Level__c DESC ]) { contacts.add(new sContact(c)); } } else { for(Contact c:[SELECT Name, FirstName, LastName, Email, Level__c, LeadSource, Id FROM Contact WHERE Name LIKE :inp+'%' AND Email LIKE :emailinp+'%' ORDER BY Level__c DESC ]) { contacts.add(new sContact(c)); } } return null; } public List<sContact> getresults() { return contacts; } public class sContact { public contact cont { get; set; } public Boolean selected { get; set; } public sContact (Contact c) { cont = c; selected = false; } } }

 

Please help me to solve this.

 

 

Thank You.

 

 

  • March 06, 2010
  • Like
  • 0

Hi,

 

I had created a S-Controls to send  emails through S-Controls based on salesforce.com tutorial. Here i can able to send emails, but i want to add the emails by selecting the records. I had created a custom list button and added in List Pagelayout, here users can select the records and when clicked on Email button it will navigate to S-Control page and in that page i'm not able to get the toAddress of the selected records. For my reference i had given the alert box to verify whether i'm able to get the selected records or not. But alert box displaying all the records i hav chosen. Can any post how to solve this problem.

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script> <script> function startPage() { IdArray = {!GETRECORDIDS( $ObjectType.Student__c )}; alert("The Selected Ids are: "+IdArray); for(var i=0; i<IdArray.length; i++) { alert(IdArray[i]); } for(var j=0; j<IdArray.length; j++) { var selectedId = sforce.connection.query( "select Email__c from Student__c where Id ='"+IdArray[j]+"' "); alert("Selected :"+ selectedId); var records = selectedId.getArray('records'); for (var k=0; k< records.length; k++) { var record = records[k]; //alert("Record Size :"+ records.length ); alert("Records: "+record.Email__c); } } var user = sforce.connection.getUserInfo().userEmail; document.getElementById('reply_to').value = user; } function setupPage() { // Called to send email var request = new sforce.SingleEmailMessage(); // create variable to hold addresses var addr= new sforce.StringBuffer(); //addr = record.Email__c; //var addr = record.Email__c; var cc= new sforce.StringBuffer(); var bcc= new sforce.StringBuffer(); addr.append(document.getElementById("to_address").value); cc.append(document.getElementById("cc_to").value); bcc.append(document.getElementById("bcc_to").value); if(document.getElementById("useSignature").checked) {request.useSignature = true; } else { request.useSignature = false; } // Email Priority is being set based on what the user selects request.emailPriority = document.getElementById("emailPriority").value; // Reply to email address of the email being set request.replyTo = document.getElementById("reply_to").value; if (document.getElementById("email_subject").value!="") { request.subject = document.getElementById("email_subject").value; } else { alert("your subject is empty, please enter a subject line or it will appear blank"); } if (document.getElementById("contentText").checked) { //request.plainTextBody=document.getElementById("email_body").value; } request.htmlBody=document.getElementById("email_body").value; } if (document.getElementById("contentHtml").checked) { request.htmlBody=document.getElementById("email_body").value; } var ToArray = new Array; ToArray = addr.toString().split(","); var CcArray = new Array; CcArray = cc.toString().split(","); var BccArray = new Array; BccArray = bcc.toString().split(","); request.toAddresses = ToArray; if (document.getElementById("cc_to").value != "") {request.ccAddresses = CcArray; } if (document.getElementById("bcc_to").value != "") {request.bccAddresses = BccArray; } var sendMailRes = sforce.connection.sendEmail([request], layoutResults); } function layoutResults(sendEmailResult) { var textNode; if (sendEmailResult.length > 0) { if (sendEmailResult[0].getBoolean("success")) { document.getElementById("output").innerHTML = "Email has been sent!";} else { document.getElementById("output").innerHTML = sendEmailResult[0].errors ;}} else { document.getElementById("output").innerHTML = "Didn't get return data."; } } </script> <style type="text/css"> <!-- .error { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; background-color: A2C2EE; } .style12 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } .style6 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; height: 16px; width: 400px;} .style7 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; height: 150px;width: 400px;} .style8 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;} .button {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;font-style: italic;font-weight: normal; background-color: C3DAF9;height: 29px; width: 53px;} --> </style> </head> <body onLoad="startPage()"> <table width="600" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div id="output" class="error"></div> </td> </tr> </table> <form name="send_email" method="post" action="javascript:setupPage()"> <table width="600" border="0" cellpadding="2" cellspacing="2" bgcolor="#C3DAF9"> <tr > <td align="right" height="50" valign="middle"><input name="Send" type="submit" class="button" id="Send" value="Send!"></td> <td align="left" height="50" valign="middle" > </td> </tr> <tr> <td width="100"><div align="right"><span class="style12">To:</span></div></td> <td width="486"><span class="style6"> <label> <input name="to" type="text" class="style6" id="to_address"> </label> </span></td> </tr> <tr> <td><div align="right"><span class="style12">cc:</span></div></td> <td><span class="style6"> <input name="cc_to" id="cc_to" type="text" class="style6"> </span></td> </tr> <tr> <td class="style12"><div align="right">Bcc</div></td> <td><span class="style6"> <input name="bcc_to" id="bcc_to" type="text" class="style6"> </span></td> </tr> <tr> <td><div align="right"><span class="style12">Reply-to:</span></div></td> <td><span class="style6"> <input name="reply_to" type="text" class="style6" id="reply_to"> </span></td> </tr> <tr> <td class="style12"><div align="right">Importance</div></td> <td><select name="emailPriority" id="emailPriority" class="style12"> <option value="Highest">Highest</option> <option value="High">High</option> <option value="Normal" selected="selected">Normal</option> <option value="Low">Low</option> <option value="Lowest">Lowest</option> </select> </td> </tr> <tr> <td><div align="right"><span class="style12">Subject</span></div></td> <td><span class="style6"> <input name="subject" type="text" class="style6" id="email_subject"> </span></td> </tr> <tr> <td><div align="right"></div></td> <td class="style12"> <input name="contentType" type="radio" id="contentText" value="text" checked>Text <input name="contentType" type="radio" id="contentHtml" value="html">HTML </td> </tr> <tr> <td><div align="right"><span class="style12">Body (text) </span></div></td> <td><span class="style6"> <textarea name="email_body" cols="20" rows="15" class="style7" id="email_body"></textarea> </span></td> </tr> <tr> <td><div align="right"><span class="style12">Use Signature </span></div></td> <td><input name="useSignature" type="checkbox" class="style8" id="useSignature" value="checkbox"></td> </tr> </table> </form> </body> </html>

 

 Thanks.

 

  • December 29, 2010
  • Like
  • 0

Hi,

 

I'm developing apex class to send mass emails from selected records, when i select records and click on send button it show runtime error.

 

I'm getting this error message

 

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

Class.wrapperClassController3.send: line 128, column 22 External entry point

 

Wat may be the problem? Please help me to rectify this.

 

Apex Class code:

public class wrapperClassController3 {
public String aMessage {
get; set;
}
public List<ID> studentids;
public List<string> studentList1=new List<string>();
//public String[] studentList1 = new List<String>();
//Our collection of the class/wrapper objects cStudent
public List<cStudent> studentList {get; set;}

//This method uses a simple SOQL query to return a List of Students
public List<cStudent> getStudents(){
if(studentList == null){
studentList = new List<cStudent>();

for(Student__c c : [select Id, First_Name__c,Last_Name__c, Email__c from Student__c limit 10]){

studentList.add(new cStudent(c));
}
}
return studentList;
}

public PageReference processSelected(){
/*We create a new list of Student that we be populated only with Students
if they are selected*/
List<Student__c> selectedStudents = new List<Student__c>();
this.aMessage = '';
/*We will cycle through our list of cStudents and will check to see if the
selected property is set to true, if it is we add the Contact to the
selectedStudentss list. */
for(cStudent cCon : getStudents()){
if(cCon.selected == true){
selectedStudents.add(cCon.con);
}
}

/* Now we have our list of selected contacts and can perform any type of
logic we want, sending emails, updating a field on the Contact, etc */
System.debug('These are the selected Students...');
Integer numselectedStudents = selectedStudents.size();
Integer counter = 0;
System.Debug(selectedStudents);
for(Student__c con : selectedStudents){
counter++;
//system.debug(con);

if(counter==numselectedStudents) {
this.aMessage += con.Id + ','+ con.First_Name__c+',' + con.Email__c;
studentList1.add(con.Id);
} else {
this.aMessage += con.Id + ','+con.First_Name__c+','+ con.Email__c+', ';
}

}
return null;



}

/* This is our wrapper/container class. A container class is a class, a data
structure, or an abstract data type whose instances are collections of other
objects. In this example a wrapper class contains both the standard salesforce
object Contact and a Boolean value */
public class cStudent
{
public Student__c con {get; set;}
public Boolean selected {get; set;}

/*This is the contructor method. When we create a new cContact object we pass a
Contact that is set to the con property. We also set the selected value to false*/
public cStudent(Student__c c){
con = c;
selected = false;

}
}

// public class mail
//{
// public String subject { get; set; }

// public String body{ get; set; }

public PageReference send()
{

Messaging.MassEmailMessage email = new Messaging.MassEmailMessage();
// String[] toAddresses = new String[] {};
List<String> TargetObjectIds = new List<String>();
//for(String s:studentList1)
//{
// String[] toAddresses = new String[] {s};
// TargetObjectIds.add(s);
//}
// ID s;

for(ID s:studentids)
{
TargetObjectIds.add(s);
}
email.setSubject( 'subject' );

//String[] toMassTargetObjects = new String[]{toMassTargetObjects};
email.setTargetObjectIds(TargetObjectIds);
//email.setPlainTextBody( body );
email.setReplyTo('chiranjeevi@datasisar.com');
email.setSenderDisplayName('Customer Support');
try{
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.MassEmailMessage[] {email});
PageReference Page = new PageReference('/mailinfo');
Page.setRedirect(true);
return Page;
// return null;
}
catch(Exception e)
{
return null;
}




}

//}
}

 

 

 

Visualforce Code.

 

 

<apex:page controller="wrapperClassController3">
<apex:outputPanel id="selected"><b>Selected: {!aMessage}</b></apex:outputPanel>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Process Selected" action="{!processSelected}" rerender="selected"/>
<apex:commandButton value="Send" action="{!send}"/>
</apex:pageBlockButtons>
<!-- In our table we are displaying the cStudent records -->
<apex:pageBlockTable value="{!students}" var="c" id="table">
<apex:column >
<!-- This is our selected Boolean property in our wrapper class -->
<apex:inputCheckbox value="{!c.selected}"/>
</apex:column>
<!-- This is how we access the student values within our cStudent container/wrapper -->
<apex:column value="{!c.con.First_Name__c}" />
<apex:column value="{!c.con.Last_Name__c}" />
<apex:column value="{!c.con.Email__c}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

 

 

 

Thank you.

 

 

Message Edited by Coder on 12-19-2009 03:24 AM
Message Edited by Coder on 12-20-2009 08:17 PM
Message Edited by Coder on 12-20-2009 08:22 PM
  • December 19, 2009
  • Like
  • 0

Hi,

 

I jus copied this code from force.com wiki tutorials, and when i click on the Process Selected it has to show the selected records in seperate table, but its not showing anyselected records, when i click on a button nothing is happening. Please check this code...

 

Apex Code.

public class wrapperClassController { //Our collection of the class/wrapper objects cContact public List<cContact> contactList {get; set;} //This method uses a simple SOQL query to return a List of Contacts public List<cContact> getContacts(){ if(contactList == null){ contactList = new List<cContact>(); for(Contact c : [select Id, Name, Email, Phone from Contact limit 10]){ /* As each contact is processed we create a new cContact object and add it to the contactList */ contactList.add(new cContact(c)); } } return contactList; } public PageReference processSelected(){ /*We create a new list of Contacts that we be populated only with Contacts if they are selected*/ List<Contact> selectedContacts = new List<Contact>(); /*We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list. */ for(cContact cCon : getContacts()){ if(cCon.selected == true){ selectedContacts.add(cCon.con); } } /* Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc */ System.debug('These are the selected Contacts...'); for(Contact con : selectedContacts){ system.debug(con); } return null; } /* This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value */ public class cContact{ public Contact con {get; set;} public Boolean selected {get; set;} /*This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false*/ public cContact(Contact c){ con = c; selected = false; } } }

 

 

Visualforce Page Code:

 

 

 

<apex:page controller="wrapperClassController"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/> </apex:pageBlockButtons> <!-- In our table we are displaying the cContact records --> <apex:pageBlockTable value="{!contacts}" var="c" id="table"> <apex:column > <!-- This is our selected Boolean property in our wrapper class --> <apex:inputCheckbox value="{!c.selected}"/> </apex:column> <!-- This is how we access the contact values within our cContact container/wrapper --> <apex:column value="{!c.con.Name}" /> <apex:column value="{!c.con.Email}" /> <apex:column value="{!c.con.Phone}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 Thank u.

 

 

  • December 17, 2009
  • Like
  • 0

Hi,

 

I'm developing flex application, i'm successfully able to connect to salesforce.com from flex page in hosted environment, but i'm not able to connect it to enterprise edition from flex page, i need to get the server url for enterprise edition.

 

can anyone help to solve this issue?

  • November 30, 2009
  • Like
  • 0
Hi,

 

I'm developing a sample application in flex. I'm trying to store the records from flex to salesforce.com, can anyone tell how to do this in flex.

 

I had tried this code to insert records from flex but its not working.Is anything wrong in my code pls check it and reply.

 

 

private function sampleinsert(lr:Object):void { force.query("SELECT Id,Department FROM Contact " + "WHERE Contact.Email='bond_john@grandhotels.com'" , new AsyncResponder(function(result:QueryResult):void { opps = result.records; })); var temp:String; //opps.Department="Medicare"; var newItems:Array= new Array(); newItem=new SObject("Contact"); //Alert.show(opps.getItemAt(0,0).Id.toString()); newItem.Id=opps.getItemAt(0,0).Id; //newItem.Name=textinput.text; //temp=opps.getItemAt(0,1).Department; newItem.Department="ssssss"; Alert.show(newItem.Department.tostring()); newItems.push(newItem); force.upsert("Id",[newItems], new AsyncResponder( function ():void{ Alert.show("ok seems like authors are saved"); } )); }

 

Thank You.
Message Edited by Coder on 10-22-2009 11:28 PM
  • October 23, 2009
  • Like
  • 0

Hi,

 

 

I want to send the email from salesforce.com to the Email field in contact's object using Force.com email services, Is it possible to do this?

 

I'm able to send emails to users within salesforce.com, i want to send mails to contacts mail in Contacts Object.

 

Any one please help me how to solve this.

 

Thanks...

  • October 09, 2009
  • Like
  • 0

Hi,

 

     We need to develop a process which integrates payment gateway solutions  for SFDC to other thrid party  products. We would like to know whether SFDC supports "First Data" payment gateway or else can u suggest us the  best payment gateway solutions to integrate seamless SFDC  to other third party product.

 

 

Thank You

Message Edited by Coder on 08-18-2009 12:09 AM
  • August 18, 2009
  • Like
  • 0

public class demods { public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); for(Streams__c p:[Select p1.Streams__c From Application__c p1])<-Error Displays Here { Application__c.add(p1.Streams__c); } List<String> Streams__c = new List<String>(Streams__c); for(integer i=0; i<Streams__c.size(); i++){ options.add(new SelectOption(Streams__c[i],Streams__c[i])); } options.add(new SelectOption('All Lunch Choices','All Lunch Choices')); return options; } }

Error: Compile Error: Invalid identifier: Streams__c

 

Hi

 

 I' m trying a code get the values from one field in an object and trying to display the unique values but whenever i saved it i'm getting the error message INVALID IDENTIFIER.Can anyone help me to solve this problem

  • July 11, 2009
  • Like
  • 0

Hi,

     I have created a PHP page in that i wrote a query to retrieve the records from salesforce.com. The query works fine and displaying the records. Now i want to display the DISTINCT records in PHP page, as salesforce.com doesn't support DISTINCT keyword can anyone tell me is there anyother way to get the DISTINCT records.

 

I have tried a function array_unique() also but its showing all the records. Pls kindly tell the alternative solution to get the DISTINCT records.

 

Message Edited by Coder on 07-17-2009 09:10 PM
  • July 11, 2009
  • Like
  • 0

Hi,

 

I'm newbie to this Salesforce.co and PHP, i created a sample custom object following this link

 

http://wiki.developerforce.com/index.php/PHP_Toolkit_13.0_Metadata_Create_Sample

 

after creating this i'm getting output as "SSL support is not available in this build" can anyone help me to rectify this problem.And can any one post how to create a standard object using PHP?

 

For example i want to create a contact object in PHP can any one help me to do this?

 

 

Thanks in Advance.

 

Message Edited by Coder on 07-17-2009 09:09 PM
  • June 29, 2009
  • Like
  • 0

Hi,

     I want to capture a information from website and directly all the information must be added to opportunity. I know how to add to leads and cases. Can anyone tell me how to do this in salesforce.com.

 

 

Thanks in advance.

 

 

 

Message Edited by Coder on 07-17-2009 09:09 PM
  • June 12, 2009
  • Like
  • 0

Hi,

 

   I created some fields in visualforce page after entering all the details and when i click on save its accepting all the values except two fields. Its not showing the values in that fields in record. Can anyone help me to solve this problem.

 

Thanks in advance.

 

 

 

Message Edited by Coder on 07-17-2009 09:08 PM
  • May 30, 2009
  • Like
  • 0

Hello Friends ,

 

               Im Creating an application where  ihave a tabpannel in which having 3 ot 4 tabs where my logic is if i enter the details in the tab and click next button next tab should be displayed. and remaining all the other tabs should become disabled. andtheremaining tabs is also follows the same proceedure where  i should navigate through the tabs using next and previous buttons only. If  any body knows how to do it can pls explain me . i went through almost all the codes that are in discussion board but i dint get it. 

 

-----------------------------------------------------------

THIS IS MY visuial force code

 

<apex:page standardController="Application__c" showHeader="false" sidebar="false" extensions="appex2">
   <script>
        .activeTab
        {
            background-color: #861515;
            color: white;
            background-image: none;
        }
        .inactiveTab
        {
            background-color: #E8E8E8;
            color: black;
            background-image: none;
        }

/*        function nexttab(tabid)
        {
           document.getElementById(maintab).selectedTab='Contact_details';
        }*/
      
    </script>

    <apex:pageblock title="EduForce" mode="edit">

    <!--Creating Tabs For Personal Details-->
        <apex:tabPanel switchType="client" id="maintab" tabClass="activeTab" inactiveTabClass="inactiveTab" value="{!TabInFocus}" >
            <apex:tab id="pdtab" label="Personal Details" rendered="true" name="Personal_Details">
            <apex:pageBlockSection title="Personal Details">
    <apex:form >
           
                </p><apex:outputLabel value="First Name"/></p>
                <apex:inputField value="{!Application__c.First_Name__c}"/>
               
                <p><apex:outputLabel value="Middle Name"/></p>
                <apex:inputField value="{!Application__c.Middle_Name__c}"/>
               
                <p><apex:outputLabel value="Last Name"/></p>
                <apex:inputField value="{!Application__c.Last_Name__c}"/>
               
                <p><apex:outputLabel value="Age"/></p>
                <apex:inputField value="{!Application__c.Age__c}"/>
               
                <p><apex:outputLabel value="Gender"/></p>
                <apex:inputField value="{!Application__c.Gender__c}" required="true"/>
               
                <p><apex:outputLabel value="Nationality"/></p>
                <apex:inputField value="{!Application__c.Country_Of_Citizenship__c}"/>
               
                <Apex:commandButton value="NEXT"  action="{!nexttab}"  />
                <apex:commandButton value="Cancel"  action="{!nothing}" />

/* HERE I DINT UNDERSTAND Whether Javascipt "onclick=nexttab(contact_Details) "to use or apex code  and  what to do next*/

           </apex:form>
           </apex:pageBlockSection>
            </apex:tab>
           
            <!--Creating a tab for Contact Details-->
            <apex:tab id="cdtab" label="Contact Details" name="Contact_Details">
            <apex:pageBlockSection title="Mailing Address">
            <apex:form >          
                <apex:outputLabel value="Address Line 1"/>
                <apex:inputfield value="{!Application__c.Address_Line_1__c}"/></br>              
                <apex:outputLabel value="Address Line 2"/>
                <apex:inputfield value="{!Application__c.Address_Line_2__c}"/></br>              
                <apex:outputLabel value="Address Line 3"/>
                <apex:inputfield value="{!Application__c.Address_Line_3__c}"/></br>               
                <apex:outputLabel value="City / Town"/>
                <apex:inputfield value="{!Application__c.City_Town__c}"/></br>              
                <apex:outputLabel value="State / Province"/>
                <apex:inputfield value="{!Application__c.State_Province__c}"/></br>               
                <apex:outputLabel value="Country"/>
                <apex:inputfield value="{!Application__c.Country__c}"/></br>              
                <apex:outputLabel value="Postal Code / Zip Code"/>
                <apex:inputfield value="{!Application__c.Zip_Code__c}"/></br>           
            </apex:form>
            </apex:pageBlockSection>           
            <apex:pageBlockSection title="Email Contact">
            <apex:form >          
                <apex:outputLabel value="Email Address"/>
                <apex:inputfield value="{!Application__c.E_Mail_ID__c}"/></br>           
            </apex:form>
            </apex:pageBlockSection>
            </apex:tab>

.......

.

.

 

.

.

</apex:page>

 

 

--------------------------------------------------------

my Apex code

 

String TabInFocus = System.currentPageReference().getParameters().get('tab');
    public void nexttab()
    {
        string x=System.currentPageReference().getParameters().get('Contact_Details');
        TabinFocus=x;
        //document.getElementById('{!$Component.maintab}').selectedTab='Contat_details';

    }
    public String getTabInFocus()
    {
            // System.debug(' *****Current Selected tab is :' + TabInFocus);
       return TabInFocus;
    }     
    public void setTabInFocus( String s )
    {
        this.TabInfocus = s;
    }

 

----------------------------------------------

IF ANY BODY KNOW PLEASE HELP ME 

  • May 28, 2009
  • Like
  • 0

Hi,

 

I created a two input fields for Fathers name and Guardians Name in visual force page, in this i want to make either one field value is required. For example here user can enter either Fathers Name or Guardians Name or else he can enter values in both fields.Here i tried if condition for checking but i'm not getting the output.Can any one help me to solve this.

 

My Visualforce Page code:

 

<apex:page controller="prac"> <apex:pageBlock > <apex:form > <p><apex:outputLabel value="Father"/></p> <apex:inputText value="{!Father}" id="fName"/> <p><apex:outputLabel value="Guardian"/></p> <apex:inputText value="{!Guardian}"/> <p><apex:commandButton value="Save" action="{!mySave}"/></p> </apex:form> </apex:pageBlock> </apex:page>

My Apex Class Code:

 

public class prac { string fname; string gname; public string getFather() { return fname; } public void setFather(string s) { this.fname=s; } public string getGuardian() { return gname; } public void setGuardian(String s){ this.gname=s; } public pageReference mySave() { pageReference newPage; if(fname == null) { newPage=Page.currentPage; } newPage=page.NextPage; return newPage; } }

 

  • May 27, 2009
  • Like
  • 1

Hi,

 

I have 3 fileds.start date(text),end date(text) and student status[picklist(values are trial,active,paid)].here my condition is if the end date is greater than 3days of start date and if the student status is "trial" then i want to delete those records.

 

In my code it is not checking the dates,it deletes entire trial records.Plz tell me modifications on my code.

Here is my code..

 

trigger expiry on chiranjeevi__Obj_D__c (before insert,before update)
 {
  List<chiranjeevi__Obj_D__c> objdlist=new List<chiranjeevi__Obj_D__c>();
  for(chiranjeevi__Obj_D__c a : Trigger.new)
  {
   objdlist=[SELECT chiranjeevi__startdate__c,chiranjeevi__enddate__c ,chiranjeevi__student_status__c from chiranjeevi__Obj_D__c WHERE chiranjeevi__student_status__c='trial']; 
    
    if(a.chiranjeevi__enddate__c > a.chiranjeevi__startdate__c.addDays(3) ) 
       {   
         delete objdlist;
       }  
   
 }
}

 

 

plz tell me how to check the date fileds.

 

Thanks in advance,

Manu..

  • June 17, 2010
  • Like
  • 0

Hi All,

 

I am new to triggers.I have 2 date fileds.

1.First_Logged_On_ Date__c,

2.Course_Expiry_Date__c.

Here i want to check check if the second date filed is greater than 3 days with compare to first date filed then i want to delete the record,

 

Plz tell me..

Thanks in advance,

Manu..

  • June 15, 2010
  • Like
  • 0

Hi,

I have opened a popup on a button click from a vfpage(parent page) , Within the popup page(child page) i am loading custom object values , within child page I have a button , when clicked on the button i should pass the values to parent page and close the child page automatically.

I am able to pass the values from child page to parent page succesfully , but The problem overhere is that i am unable to close the child window. I am using window.close() method in IE7 but it is not working can anyone help me out.

 

Thanks

Hi,

 

I'm creating a visualforce page for searching the Contact Names from contact records. I can able to search the records and display it in visualforce page. But when i added the pagination functionality its not working in these page. Am i missing anything or my approach is wrong. Please help me to solve this problem.

 

 

Visualforce Page code...

 

 

<apex:page standardController="Contact" extensions="ContactSearch" showHeader="false" sidebar="false"> <apex:form > <apex:sectionHeader title="Search Contacts"/> <apex:pageBlock > <apex:pageBlockSection title="Contacts"> </apex:pageBlockSection> <!--Panel grid to get the input from users --> <apex:panelGrid columns="2"> <apex:outputLabel style="font-weight:bold;" value="Contact Name"></apex:outputLabel> <apex:inputtext value="{!inp}"/> <apex:outputLabel style="font-weight:bold;" value="Contact Email"></apex:outputLabel> <apex:inputText value="{!emailinp}"/> <apex:OutputLabel value="Select Lead Source" style="font-weight:bold;"/> <apex:selectList value="{!lsource}" size="1"> <apex:selectOptions value="{!Source}"></apex:selectOptions> </apex:selectList> </apex:panelGrid> <apex:commandButton value="Search" action="{!search}"/> <apex:pageBlockSection title="Search results" columns="1"> <apex:outputPanel id="contacts"></apex:outputPanel> <apex:pageBlockTable value="{!results}" var="contactsList"> <!--<apex:column> <apex:facet name="header"></apex:facet> </apex:Column>--> <apex:column headerValue="Contact First Name"> <apex:outputText value="{!contactsList.cont.Name}"/> </apex:column> <apex:column headerValue="Contact Email"> <apex:outputText value="{!contactsList.cont.Email}"/> </apex:column> <apex:column headerValue="Level"> <apex:outputText value="{!contactsList.cont.Level__c}"/> </apex:column> <apex:column headerValue="Lead Source"> <apex:outputText value="{!contactsList.cont.LeadSource}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> <apex:panelGrid columns="4"> <apex:commandLink action="{!first}">First</apex:commandlink> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink> <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink> <apex:commandLink action="{!last}">Last</apex:commandlink> </apex:panelGrid> </apex:form> </apex:page>

 

 Apex Class code.....

 

 In these apex class i'm not able to modify the Controllers Database.getQuerylocator. Now, when i click the search button in visuaforce page it will displays the record, but i want to give the pagination for that records.

public class ContactSearch { //List<categoryWrapper> categories {get; set;} public ContactSearch(ApexPages.StandardController controller) { cid = System.currentPageReference().getParameters().get('id'); } Public ApexPages.StandardSetController con { get { if(con == null) { con = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id, Name FROM Contact ORDER BY Name LIMIT 50])); con.setPageSize(5); } return con; } set; } /*Public List<categoryWrapper> getCategories() { categories = new List<categoryWrapper>(); return categories; } */ Public String cid; String inp; String emailinp; String leadsource; String lsource; String Source; public List<Contact> results = new List<Contact>(); public List<sContact> contacts { get; set; } Public Boolean hasNext { get { return con.gethasNext(); } set; } Public Boolean hasPrevious { get { return con.gethasPrevious(); } set; } Public integer pageNumber { get { return con.getpageNumber(); } } public void first() { con.first(); } public void last() { con.last(); } public void previous() { con.previous(); } public void next() { con.next(); } /* Getting the input from the user in the contact name text box and the values are assigned here */ public String getinp() { return inp; } public void setinp(String i) { this.inp = i; } /* -------------------------------------------------- */ /* Getting and Setting the input from the user in the contact email and the values are assigned here */ public String getemailinp() { return emailinp; } public void setemailinp(String email) { this.emailinp = email; } /* ------------------------------------------------------------------------ */ /* Getting and setting the values from the user in the lead source */ public string getleadsource() { return leadsource; } public void setleadsource(String ls) { this.leadsource = ls; } /* ------------------------------------------------------------------------ */ /* Getter and Setter value for Select List */ public string getlsource() { return lsource; } public void setlsource(String lsource) { this.lsource = lsource; } /* ------------------------------------------------------------------------------ */ /* */ public List<selectOption> getSource() { List<selectOption> val = new List<selectOption>(); val.add(new selectOption('','--None--')); val.add(new selectOption('Partner','Partner')); val.add(new selectOption('Web','Web')); val.add(new selectOption('Phone Inquiry','Phone Inquiry')); val.add(new selectOption('Partner Referral','Partner Referral')); val.add(new selectOption('Purchased List','Purchased List')); return val; } public void setSource(String source) { this.Source = source; } public List<contact> search() { contacts = new List<sContact>(); if(lsource!=null) { for(Contact c : [SELECT Name, FirstName, LastName, Email, Level__c, LeadSource, Id FROM Contact WHERE Name LIKE :inp+'%' AND Email LIKE :emailinp+'%' AND LeadSource LIKE:lsource+'%' ORDER BY Level__c DESC ]) { contacts.add(new sContact(c)); } } else { for(Contact c:[SELECT Name, FirstName, LastName, Email, Level__c, LeadSource, Id FROM Contact WHERE Name LIKE :inp+'%' AND Email LIKE :emailinp+'%' ORDER BY Level__c DESC ]) { contacts.add(new sContact(c)); } } return null; } public List<sContact> getresults() { return contacts; } public class sContact { public contact cont { get; set; } public Boolean selected { get; set; } public sContact (Contact c) { cont = c; selected = false; } } }

 

Please help me to solve this.

 

 

Thank You.

 

 

  • March 06, 2010
  • Like
  • 0

Hi,

 

I jus copied this code from force.com wiki tutorials, and when i click on the Process Selected it has to show the selected records in seperate table, but its not showing anyselected records, when i click on a button nothing is happening. Please check this code...

 

Apex Code.

public class wrapperClassController { //Our collection of the class/wrapper objects cContact public List<cContact> contactList {get; set;} //This method uses a simple SOQL query to return a List of Contacts public List<cContact> getContacts(){ if(contactList == null){ contactList = new List<cContact>(); for(Contact c : [select Id, Name, Email, Phone from Contact limit 10]){ /* As each contact is processed we create a new cContact object and add it to the contactList */ contactList.add(new cContact(c)); } } return contactList; } public PageReference processSelected(){ /*We create a new list of Contacts that we be populated only with Contacts if they are selected*/ List<Contact> selectedContacts = new List<Contact>(); /*We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list. */ for(cContact cCon : getContacts()){ if(cCon.selected == true){ selectedContacts.add(cCon.con); } } /* Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc */ System.debug('These are the selected Contacts...'); for(Contact con : selectedContacts){ system.debug(con); } return null; } /* This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value */ public class cContact{ public Contact con {get; set;} public Boolean selected {get; set;} /*This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false*/ public cContact(Contact c){ con = c; selected = false; } } }

 

 

Visualforce Page Code:

 

 

 

<apex:page controller="wrapperClassController"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/> </apex:pageBlockButtons> <!-- In our table we are displaying the cContact records --> <apex:pageBlockTable value="{!contacts}" var="c" id="table"> <apex:column > <!-- This is our selected Boolean property in our wrapper class --> <apex:inputCheckbox value="{!c.selected}"/> </apex:column> <!-- This is how we access the contact values within our cContact container/wrapper --> <apex:column value="{!c.con.Name}" /> <apex:column value="{!c.con.Email}" /> <apex:column value="{!c.con.Phone}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 Thank u.

 

 

  • December 17, 2009
  • Like
  • 0

Hi,

 

I'm developing flex application, i'm successfully able to connect to salesforce.com from flex page in hosted environment, but i'm not able to connect it to enterprise edition from flex page, i need to get the server url for enterprise edition.

 

can anyone help to solve this issue?

  • November 30, 2009
  • Like
  • 0

Hi,

 

 

I want to send the email from salesforce.com to the Email field in contact's object using Force.com email services, Is it possible to do this?

 

I'm able to send emails to users within salesforce.com, i want to send mails to contacts mail in Contacts Object.

 

Any one please help me how to solve this.

 

Thanks...

  • October 09, 2009
  • Like
  • 0

Hi,

 

I'm newbie to this Salesforce.co and PHP, i created a sample custom object following this link

 

http://wiki.developerforce.com/index.php/PHP_Toolkit_13.0_Metadata_Create_Sample

 

after creating this i'm getting output as "SSL support is not available in this build" can anyone help me to rectify this problem.And can any one post how to create a standard object using PHP?

 

For example i want to create a contact object in PHP can any one help me to do this?

 

 

Thanks in Advance.

 

Message Edited by Coder on 07-17-2009 09:09 PM
  • June 29, 2009
  • Like
  • 0

Hi,

 

I created a two input fields for Fathers name and Guardians Name in visual force page, in this i want to make either one field value is required. For example here user can enter either Fathers Name or Guardians Name or else he can enter values in both fields.Here i tried if condition for checking but i'm not getting the output.Can any one help me to solve this.

 

My Visualforce Page code:

 

<apex:page controller="prac"> <apex:pageBlock > <apex:form > <p><apex:outputLabel value="Father"/></p> <apex:inputText value="{!Father}" id="fName"/> <p><apex:outputLabel value="Guardian"/></p> <apex:inputText value="{!Guardian}"/> <p><apex:commandButton value="Save" action="{!mySave}"/></p> </apex:form> </apex:pageBlock> </apex:page>

My Apex Class Code:

 

public class prac { string fname; string gname; public string getFather() { return fname; } public void setFather(string s) { this.fname=s; } public string getGuardian() { return gname; } public void setGuardian(String s){ this.gname=s; } public pageReference mySave() { pageReference newPage; if(fname == null) { newPage=Page.currentPage; } newPage=page.NextPage; return newPage; } }

 

  • May 27, 2009
  • Like
  • 1

Hi,

    I created a fields in a visualforce page and when i enter all the fields and click on save button its saving the record and redirecting to proper records page.Now i want to make this page as public and without logging in salesforce user has to enter all the fields and the moment user clicks the save button it has to save the record and redirect to particular page.Now here i completed visualforce page to sites and got the output,but when i enter all the fields and click on save button its showing unauthorised access and you need to login with proper username and password.Can anyone pls tell how to make public and what to done on save action and page redirection.

 

Thanks in advance.

 

 

Message Edited by Coder on 07-17-2009 08:51 PM
  • May 18, 2009
  • Like
  • 0

HI,

     I want to change the date format in date field now the default format is MM/DD-YYYY now i want to change that in DD-MM-YYYY.Is it possible in force.com and if any one knows how to change the format please reply.

 

Thanks You Very much.

 

 

 

Message Edited by Coder on 07-17-2009 08:49 PM
  • May 15, 2009
  • Like
  • 0

Hi,

 

I am creating a sample application in that i want to add the field values in salesforce by reading the attachment email.If anyone did this before or if u hav any idea for how to work it out pls post it here and it will be helpful for someone also.

  • May 06, 2009
  • Like
  • 0
There is some difference between the version in bin-debug, which works fine, and the version in bin-release, which doesn't successfully connect to salesforce.com.  I'm new to this and just don't know what the difference could be.  Any suggestions?
  • January 16, 2009
  • Like
  • 0