• Lee.ax1423
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 11
    Replies
Hi, I am doing bulk insert in custom object from visualforce page using controllers.. In that custom object I have two fields called startdate__c ,enddate__c. I fired some validation rule on that i.e enddate__c < startdate__c. while I am entering data from visualforce page if I enter endate less than start date its showing error in visualforce page.. and after I correct and click save button it is showing System.ListException: Before Insert or Upsert list must not have two identically equal elements error. I am not aware of that.. can any one knows about this.. Here is my Controller :- public class ProjectMileStonesCon { /* public List wrappers {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=1; public Customobj1__c cusob; public List mls = new List(); public ProjectMileStonesCon(ApexPages.StandardController controller) { wrappers=new List(); cusob = (Customobj1__c)controller.getRecord(); for (Integer idx=1; idx<=1; idx++) { wrappers.add(new PTeamWrapper(nextIdent++,cusob)); } } public void delWrapper() { Integer toDelPos=-1; for (Integer idx=0; idx

Hi....

I have created site in force.com sites....It's looking good in chrome and firefox browsers but when coming to IE the syles are not applying i am not getting why this will be happened.

My css code is:-

  .sidebar { margin: 0px 0px 0px 25px; } .sidebar h99 span1{ background:#00AEEF; color:#fff; width:200px; text-align:left; font-family:Comic Sans MS; font-size: 18px; font-weight:bold; }

 

body{ background:#F4F7F3 repeat-x top; font-size: 45%; font-family: Comic Sans MS, Georgia, Times, serif;
margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;}
1a{ color:#32780E; text-decoration: none; }
a{ color:#15769A; text-decoration: none; }

.pagespot {
    padding: 10px 20px;
    margin: 0px 0px 0px 0px;
    background: white;
    
}

 

and i called this styles in my pages like this..

 

<link href="{!$Resource.SiteCss}" rel="stylesheet" />

 

can anyone help me how to solve this and how to write global css for all the browsers..

Thanks,

Can any one help me for writing test cases for following code.. I have written something but it is not entering in for loop.

code here....

 

private List<Contact> acc;
public String Combination = '';

public MyClass(ApexPages.StandardSetController controller) {
acc = (List<contact>)controller.getSelected();
for (contact ac:acc){
if(ac.MobilePhone != null){
Combination = ac.MobilePhone+','+Combination;
}else{
Combination = '';
break;
}}}
 

Thanks,

Hi,

 

I am facing problem with unit test cases.....Recently i have integrated salesforce with outer environment.

but the problem is i got the test failure message while writing unit test cases for that.

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

Class.SendSMSHttpContact.<init>: line 9, column 1 Class.TestSendSMS.testUnas1: line 15, column 1

 

Code is:

 

public class SendSMSHttpContact {

private final Contact contact;
private final String user='some name';
private final String senderID='some';
public String receipientno{get;set;}
private final String dcs='0';
public String msgtxt{get;set;}
public String msg = msgtxt.replace(' ','%20');
private final String state='0';
String endpoint = 'sample url';

public SendSMSHttpContact(ApexPages.StandardController controller) {
this.contact = (Contact)controller.getRecord();
}

public PageReference SendSMS() {

if (contact.MobilePhone != null) {

receipientno = contact.MobilePhone;
receipientno = receipientno.replace('+','');
receipientno = receipientno.replace(' ','');
receipientno = receipientno.replace(')','');
receipientno = receipientno.replace('(','');
receipientno = receipientno.replace('-','');

//construct an HTTP request
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint(endpoint+'?user='+user+
'&senderID='+senderID+
'&receipientno='+receipientno+
'&dcs='+dcs+
'&msgtxt='+msg+
'&state='+state);

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

//check the response
if (res.getStatusCode() == 200) {

Task smsTask = new Task (Type='SMS',
WhoID = contact.id,
Status = 'Completed',
ActivityDate = System.today(),
Description = msg.replace('%20',' '),
Subject = 'SMS Sent'
);
try {
insert smsTask;
} catch (System.Dmlexception e) {
System.debug('Error: Unable to insert task: ' + e);
}
PageReference pg = new PageReference('/'+smsTask.Id);
return pg;
} else {

//do something
}
}
else {

//do something
}}}

 

 

unit test coding is:

 

@isTest
private class TestSendSMS{
private static testMethod void testUnas1(){


String endpoint='http://google.com';
Contact con = new Contact();
con.LastName = 'test';
con.MobilePhone ='12345';
insert con;

ApexPages.StandardController controller = new ApexPages.StandardController(con);
SendSMSHttpContact test = new SendSMSHttpContact(controller);
system.assertEquals(Page.success,test.SendSMS());

}}

 

 

 

i am in basic stage in writting unit test cases.

can you help me to write unit test case for this.

 

Past two days onwards i am searching for this.

 

can any one help me to get out of this.!!!!!

Can any one write Unit test cases for following code.....

 

 

public PageReference SendSMS() {

if (a != null) {

//construct an HTTP request
HttpRequest req = new HttpRequest();

req.setEndpoint('sample endpoint');
req.setMethod('GET');

 

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

 

//check the response
if (res.getStatusCode() == 200) {

   smsTask = new Task (Type='SMS');
try {
insert smsTask;
} catch (System.Dmlexception e) {
System.debug('Error: Unable to insert task: ' + e);
}
PageReference pg = new PageReference('/'+smsTask.Id);
return pg;

} else {
ApexPages.Message didNotSendMsg = new ApexPages.Message(ApexPages.severity.Info, 'some message');
ApexPages.addMessage(didNotSendMsg);
return null;
}
}
else {
ApexPages.Message noMobileMsg = new ApexPages.Message(ApexPages.severity.Info,'some message');
ApexPages.addMessage(noMobileMsg);
return null;
}

 

Help me!!!

Hi,

Can you tell me how to write test cases for Htttp callouts here is the sample code.

 

public PageReference Send() {

 

HttpRequest req = new HttpRequest();
    
    req.setEndpoint('url');
    req.setMethod('GET');

    //send the request
    Http http = new Http();
    HttpResponse res = http.send(req);

    //check the response
    if (res.getStatusCode() == 200) {

         //do something//

 } else {
      //do something
    } 

 

can you help me???

Hi can any one help me on this problem.

In below i have created a task in a specific contact.while i am click the send button in visualforce page the following task will be created and goes to particular contact page whic id we have passed.but i dont want to go my contact page.I want to go my task page which i have previously created in the following code.

here be my sample code.

 

private final Contact contact;

public Task smsTask;

public SendSMSHttpContact(ApexPages.StandardController controller) {
this.contact = (Contact)controller.getRecord();
}

 

public PageReference SendSMS() {

 

smsTask = new Task (Type='SMS',
WhoID = contact.id,
Status = 'Completed',
ActivityDate = System.today(),
Description = msg.replace('%20',' '),
Subject = 'SMS Sent'
);
try {
insert smsTask;
} catch (System.Dmlexception e) {
System.debug('Error: Unable to insert task: ' + e);
}
return new ApexPages.StandardController(contact).view();/*here i am returning to contact page,I want to go task page which i have created*/

}

 

Help??????????

Hii,

 

I want to integrate salesforce.com with some external service like mvaayoo.com using HTTP Api,to send messages.

 

I need basic information about Calling external services using HTTP Api.What i want to do exactly is i would like to send message from salesforce with help of mvaayoo.com.

 

I need information for calling external services using HTTP Api.

 

Help???????/

Thanks

I want to display list values in visual force page but i want to display in single filed with comma separated values.

For example i have ten contacts in my contact object.I want to display these all contact names or another filed in a text box with comma separated.(ex: Lee,jeff,dogules).

 

Can any one help me how to achieve this.......

 

Help!!!!!!!!!!!!!

Hi, I am doing bulk insert in custom object from visualforce page using controllers.. In that custom object I have two fields called startdate__c ,enddate__c. I fired some validation rule on that i.e enddate__c < startdate__c. while I am entering data from visualforce page if I enter endate less than start date its showing error in visualforce page.. and after I correct and click save button it is showing System.ListException: Before Insert or Upsert list must not have two identically equal elements error. I am not aware of that.. can any one knows about this.. Here is my Controller :- public class ProjectMileStonesCon { /* public List wrappers {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=1; public Customobj1__c cusob; public List mls = new List(); public ProjectMileStonesCon(ApexPages.StandardController controller) { wrappers=new List(); cusob = (Customobj1__c)controller.getRecord(); for (Integer idx=1; idx<=1; idx++) { wrappers.add(new PTeamWrapper(nextIdent++,cusob)); } } public void delWrapper() { Integer toDelPos=-1; for (Integer idx=0; idx

Can any one help me for writing test cases for following code.. I have written something but it is not entering in for loop.

code here....

 

private List<Contact> acc;
public String Combination = '';

public MyClass(ApexPages.StandardSetController controller) {
acc = (List<contact>)controller.getSelected();
for (contact ac:acc){
if(ac.MobilePhone != null){
Combination = ac.MobilePhone+','+Combination;
}else{
Combination = '';
break;
}}}
 

Thanks,

Can any one write Unit test cases for following code.....

 

 

public PageReference SendSMS() {

if (a != null) {

//construct an HTTP request
HttpRequest req = new HttpRequest();

req.setEndpoint('sample endpoint');
req.setMethod('GET');

 

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

 

//check the response
if (res.getStatusCode() == 200) {

   smsTask = new Task (Type='SMS');
try {
insert smsTask;
} catch (System.Dmlexception e) {
System.debug('Error: Unable to insert task: ' + e);
}
PageReference pg = new PageReference('/'+smsTask.Id);
return pg;

} else {
ApexPages.Message didNotSendMsg = new ApexPages.Message(ApexPages.severity.Info, 'some message');
ApexPages.addMessage(didNotSendMsg);
return null;
}
}
else {
ApexPages.Message noMobileMsg = new ApexPages.Message(ApexPages.severity.Info,'some message');
ApexPages.addMessage(noMobileMsg);
return null;
}

 

Help me!!!

Hi,

Can you tell me how to write test cases for Htttp callouts here is the sample code.

 

public PageReference Send() {

 

HttpRequest req = new HttpRequest();
    
    req.setEndpoint('url');
    req.setMethod('GET');

    //send the request
    Http http = new Http();
    HttpResponse res = http.send(req);

    //check the response
    if (res.getStatusCode() == 200) {

         //do something//

 } else {
      //do something
    } 

 

can you help me???

Hii,

 

I want to integrate salesforce.com with some external service like mvaayoo.com using HTTP Api,to send messages.

 

I need basic information about Calling external services using HTTP Api.What i want to do exactly is i would like to send message from salesforce with help of mvaayoo.com.

 

I need information for calling external services using HTTP Api.

 

Help???????/

Thanks

I want to display list values in visual force page but i want to display in single filed with comma separated values.

For example i have ten contacts in my contact object.I want to display these all contact names or another filed in a text box with comma separated.(ex: Lee,jeff,dogules).

 

Can any one help me how to achieve this.......

 

Help!!!!!!!!!!!!!

Hello All,

 

I have a custom page and controller.  I am trying to do some error handling within the controller as such:

 

public PageReference sendMail2PM(){
   

string PMID = [select Deliverable_Owner__c from P4_Contract_Deliverable__c where id = :this.cd.id].Deliverable_Owner__c;

 

string PMEmail = [select email from contact where id=:PMID].email;

 

if(PMEmail==null){
    PageReference errorPage = new PageReference('https://cs1.salesforce.com/apex/errorLanding');
    errorPage.setRedirect(true);
    return errorPage;
    }

 

}

 

My problem is that when the redirect happens, somehow "inline=1" gets appended to the URL.  It seems that when the inline parameter is present then the page renders without headers or sidebars.  I want the header and sidebar so users know they are still in saleforce.

 

Where is the "inline=1" coming from and how do I get rid of it?  Or else how do I make the redirect happen with headers and sidebars?

  • February 05, 2009
  • Like
  • 0