• deepakM
  • NEWBIE
  • 100 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 91
    Questions
  • 164
    Replies

hi everyone

 

i need to cover the below lines but unable to do that.

 

The code is as follows:

Webservice static string Submit(string oppId)
{

 

string message = '';
boolean flag = true;

 

Flight_Request__c[] tf = [SELECT id,Customer_Approved_Itinerary__c,Opportunity__c FROM Flight_Request__c WHERE Opportunity__c = :oppId and Customer_Approved_Itinerary__c = true ];
if (tf.size() != 1)
{
message += 'Flight Request must contain only one record with Customer Approved Itinerary true \n';
flag = false;
}

 

}

 

 

My Test class method

 

static testMethod void myUnitTest() {

string message = '';
boolean flag = true;

 

Flight_Request__c fr = new Flight_Request__c();
fr.Budget__c = '23';
fr.Publish_Fare__c = '35';
fr.Flight_Itinerary_Name__c ='Test';
fr.Opportunity__c = opp.Id;
fr.From__c = opp.Origin_City__c;
fr.To__c = opp.Destination_City__c;
fr.Outbound_del__c = opp.Departure_Date__c;
fr.Pax_del__c = opp.Number_of_Passengers__c;
fr.Region_del__c = opp.Destination_Zone__c;
fr.Inbound_del__c = opp.Return_Date__c;
fr.Outbound_Flexibility__c = opp.Flexibility_From__c;
fr.Inbound_Flexibility__c = opp.Flexibility_To__c;
fr.Email_To__c ='anil@swiftsetup.com';
fr.Email_Content__c= 'Test';
fr.Subject__c ='subject test';
fr.Customer_Approved_Itinerary__c = true;
fr.Flight_Info__c = 'Test';
fr.Searcher_New__c ='Anil D';
fr.Email_Cc__c ='dm@we.com';
fr.Email_Bcc__c ='anil@we.com';
insert fr;

 

 

}

 

but it not coverd the above red lines.

 

please guide me.

 

Thanks

Hi everyone,

 

I have one sys admin login and other is enduser login.suppose if sysadmin changes the opportunity stage to "completed" thn the enduser unable to change the stage, that i did using validation rule but i need that if the opportunity stage is "completed" the enduser unable to edit the opportunity data mean other fields too. i did it using the validatin rule that is stage is completed and user is not other thn sys admin thn we can not edit the opportunity ,as opp consist of various related list(many obj related to opp) so i did again  same for these objects also.

 

i need to knw is there any other way too handle this thing in salesforce. so if the opp stage is completed then the enduser unable to change the opp data as well as its related list too.

 

 

Thanks

 

 

hi everyone

 

From last fews days i am trying to deploy a class with good test coverge but i unable to achieve that.

 

pleas help me to get the best code coverage as i tried to fix all the point in test case but even though i fail to do so.

 

 

My apex class is shown below and red lines are not coverd.

 

public class FFPage {

FF__c FF;
public List<Opportunity> listOpp;
public String Id {get; set;}
public Opportunity Opp {get; set;}
public String Msg {get; set;}
public boolean chkConfirm {get;set;}
public boolean chkAcct {get;set;}
public static boolean isApexTest = false;
//boolean flag = false;
public FFPage(ApexPages.StandardController stdController)
{
FF = (FF__c)stdController.getRecord();
Id = FF.Opportunity__c;

}

public PageReference Save()
{
chkConfirm = false;
chkAcct = false;
Msg = Apexpages.currentPage().getParameters().get('one');
System.debug('*************Msg************ : ' + Msg );


try
{

if(FF.Id == null)
{
string obj = main(FF.Opportunity__c,FF.Id,FF.FFGuid__c,FF.Account_Number__c,FF.Account_Type__c,FF.Last_Name__c,FF.Miles__c,FF.Password__c,'add',Msg );
// if(obj.contains('success'))
System.debug('*************RailMsgobj*********'+obj);
if(obj.contains('success')|| obj=='success')
{
System.debug('*************Railsobj*********'+obj);
string[] parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}
System.debug('*************Guid*********'+FF.FFGuid__c);
insert FF;
System.debug('insert');
// ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, parts[0]));
PageReference pr = new PageReference('https://c.cs9.visual.force.com/apex/FFPage?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
pr.setRedirect(true);
pr.getParameters().put('paramName', 'Saved Successfully');
return pr;

}
else
{
System.debug('notinsert');
// obj == 'Not enough miles in account';
//chkConfirm = true;
if(obj.contains('Not enough miles in account')|| obj=='Not enough miles in account')
{
chkConfirm = true;
}
else if(obj.contains('Account does not exist')|| obj=='Account does not exist')
{
System.debug('*************AccountNot*********'+obj);
chkAcct = true;
}
else
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING,obj));
}


}

}
else
{
string userID;
userID = userinfo.getProfileId();
userID = userID.substring(0,15);
System.debug('*************LoginuserID *********'+userID );
Decimal miles;
if(userID != '00ed0000000vQrA')
{

Opportunity opp = [SELECT id, StageName FROM Opportunity WHERE Id = :FF.Opportunity__c];

if(opp .StageName == 'Completed')
{
FF__c ffobj = [SELECT id, Miles__c FROM FF__c WHERE Id = :FF.id];
if(ffobj != null)
{
if(ffobj.Miles__c != null)
{
miles = ffobj .Miles__c;
}
}
}
else
{
miles = FF.Miles__c;

}

}
else
{
miles = FF.Miles__c;

}
System.debug('*************NewMiles*********'+miles );

string obj = main(FF.Opportunity__c,FF.Id,FF.FFGuid__c,FF.Account_Number__c,FF.Account_Type__c,FF.Last_Name__c,miles,FF.Password__c,'update',Msg);
if(obj.contains('success')|| obj=='success')
{
string[] parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}
System.debug('*************Guidupdate*********'+FF.FFGuid__c);
try
{
update FF;
System.debug('update');
//ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, obj));
PageReference pr = new PageReference('https://c.cs9.visual.force.com/apex/FFPage?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
pr.setRedirect(true);
pr.getParameters().put('paramName', 'Updated Successfully');
return pr;

}
catch(Exception e)
{
string expmsg = e.getMessage();
System.debug(expmsg);
if(expmsg.contains('FIELD_CUSTOM_VALIDATION_EXCEPTION, Opportunity is closed,You cannot edit the MIles.'))
{

System.debug('DmlException');
// ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, 'Opportunity is closed,You cannot edit the MIles'));
PageReference pr = new PageReference('https://c.cs9.visual.force.com/apex/FFPage?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
pr.setRedirect(true);
pr.getParameters().put('paramName', 'Opportunity is closed,You cannot edit the MIles');
return pr;
}
}

}
else
{
System.debug('notupdate');
if(obj.contains('Not enough miles in account')|| obj=='Not enough miles in account')
{
chkConfirm = true;
}
else if(obj.contains('Account does not exist')|| obj=='Account does not exist')
{
chkAcct = true;
}
else
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, obj));
}
//PageReference pr = new PageReference('https://c.na14.visual.force.com/apex/FFPage?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
// pr.setRedirect(true);
// pr.getParameters().put('paramName', obj);
// return pr;
}



}



}

catch(DmlException ex)
{

}
return null;
}
public String main(String opid,String ffid,String guid,String actnu,String acttype,String lastn,Decimal miles,String pwd,String action,String Chkmiles)
{

SalesForceUrl__c sf = SalesForceUrl__c.getValues('AMUrl');
SalesForceUrl__c sf2 = SalesForceUrl__c.getValues('IsSandBox');
// Do a whole bunch of stuff

// Build the http request
HttpRequest req = new HttpRequest();
Http h = new Http();

if( sf != null && sf2!= null)
{
req.setEndpoint(sf.SettingValue__c+'/salesforce/test?oppid='+ opid+'&ffid='+ffid+'&guid='+guid +'&acctnu='+actnu +'&accttype='+acttype+'&lastname='+lastn+'&miles='+miles+'&pwd='+pwd+'&actionType='+action+'&IsSandbox='+sf2.SettingValue__c+'&Chkmiles='+Msg);

}
req.setMethod('GET');

// Invoke web service call
String result = '';
if (!isApexTest){
// Make a real callout since we are not running a test
HttpResponse res = h.send(req);
result = res.getBody();
System.debug('Result=' +result);
System.debug('STATUS:'+res.getStatus());
} else {
// A test is running
result = 'success';
}

// Do whole bunch of stuff

return result;
}


// Wrapper method for "main" that we will call in the Test Class
public String mainForTest(){
isApexTest = true;
DateTime dT = System.now();
Decimal i = 1.2;
return main('006d0000007jfwO','a00d000000560NZ','a00d000000560NZ','11','AA','aa',i,'asd','add','true');
}
public PageReference Cancel()
{

PageReference pr = new PageReference('/' + Id);
pr.setRedirect(true);
return pr;
}
}

 

 

 

 

MY Test Class is 

 

 

 

@isTest
private class FFPageTestCase {

static testMethod void myUnitTest() {
FF__c FF;
List<Opportunity> listOpp;
List<FF__c> listFF;
String Id;
String result;
String webresult;
String webresultu;

string obj = '';
List<String> parts;


Opportunity opp = new Opportunity();
opp.Name = 'Test Opp';
opp.StageName = 'Ticketing';
opp.p1_First_Name__c ='A';
opp.p1_Last_Name__c ='D';
opp.p1_Gender__c = 'S';
opp.p1_First_Name__c ='S';
opp.p1_Last_Name__c ='A';
opp.p1_Gender__c = 'D';
opp.DOB_Main_Passenger__c = System.now().date();
opp.Number_of_Passengers__c = 4;
opp.CloseDate = System.now().date();
opp.Departure_Date__c = System.now().date();
opp.Origin_City__c = 'DEL';
opp.Destination_City__c= 'MUI';
opp.Return_Date__c = System.now().date();
opp.Override_Itinerary_Builder__c = true;
opp.Complete_Itinerary_Information__c ='test';
opp.Approved__c ='Test1';
opp.AmMessage__c ='success';
insert opp;

FF = new FF__c();
FF.Account_Number__c ='1234456';
FF.Account_Type__c = 'ANA';
FF.DOB__c = system.today();
FF.Opportunity__c = opp.Id;
FF.Last_Name__c = 'Dutt';
FF.Miles__c = 1.2;
FF.Password__c= 'asd';
FF.Mileage_Cost__c = 0.0210;
FF.FFGuid__c ='hhhhdofhff';
webresult = 'success';
obj = 'Success,785765876';
parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}

insert FF;
opp.StageName = 'FF Account Assigned';
update opp;


webresultu = 'success';
update FF;


try
{
ApexPages.StandardController sc = new ApexPages.StandardController(FF);
FFPage sc1 = new FFPage(sc);


String retVal = sc1.mainForTest();
// Add asserts for validation
String expectedResult = 'success';
System.assertEquals(retVal, expectedResult);
sc1.Save();


FF__c FF2 = new FF__c();
FF2.Account_Number__c ='1234456';
FF2.Account_Type__c = 'ANA';
FF2.DOB__c = system.today();
FF2.Opportunity__c = opp.Id;
FF2.Last_Name__c = 'Dutt';
FF2.Miles__c = 1.2;
FF2.Password__c= 'asd';
FF2.Mileage_Cost__c = 0.0210;
FF.FFGuid__c ='hhhhdofhff';
webresult = 'success';
insert FF2;

SalesForceUrl__c sf = new SalesForceUrl__c();
sf.Name ='AMUrl';
sf.SettingValue__c ='test';
insert sf;
SalesForceUrl__c sf2 = new SalesForceUrl__c();
sf2.Name ='IsSandBox';
sf2.SettingValue__c ='true';
insert sf2;
sc1.Cancel();
}

catch(System.CalloutException e)
{
webresult = e.getMessage();
}
System.assertEquals(webresult,'success');

}
}

 

 

 

 

Please help me to get rid of this.

 

thanks

 

 

HI everyone.

 

i need to know how we can send a parameters to apex method .as my button like below

 

   <apex:commandButton action="{!save}" onclick="return confirm('are you sure?');" value="TSave" /> 

 

As when we hit the ok ,we need to send a parameter to the save action .

 

 

Please help me.

 

Thanks.

HI community.

 

I have one vf page related to custom object ff having Opportunity as a Master-Detail(Opportunity).

in vf page i have one inputtag as below

    <apex:inputField label="Opportunity" value="{!FF__c.Opportunity__c}"  />

 

during create ,textbox is open for opportunity abd during edit the readonly field,so in this cas i need it to a click able and redirect to opportunity page.
 
As i have one action in controller which work perfectly but i need it in opportunity case in edit mode.
 
 
Thanks

hi every one

 

i have two user.

1. admin

2. test

 

if the stage is completed then the user test unable to change the opportunity stage if the stage is "completed" only admin can change it.

For that i created the validation rule but it not work

 

AND ( 
ISPICKVAL(StageName, "Completed") 
, $User.ProfileId != "056560000666")

}

 

here this is admin prfofile id 056560000666.

 

But it not work.

 

please guide me.

 

thanks

HI everyone.

 

i have two custom objects named:

Airline,

Eticket.

In both the  custom object i used one picklist in each but having same values as like:

 

1. Object: Airline

Picklist name :Airline_name 

 

2. Object: Eticket

Picklist name:Airline_name 

 

 

I need that to be manage in one place, that if i change there it will depict in both the cases.

 

Please guide how can i get this common functionality work for both the custom objects.

 

 

Thanks

 

 

hi every one.

 

I need 100% code coverage for the class ,i tried to make a test class but it not covered 100%  just 70%

 

Below is my class as well as test class as under:

 

My Class

 

public class WebServiceSalesforceFeed{
@future (callout =true)
public static void HttpResult(String oppID) {
SalesForceUrl__c sf = SalesForceUrl__c.getValues('AMUrl'); // custom setting objects.
SalesForceUrl__c sf2 = SalesForceUrl__c.getValues('IsSandBox');
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
if(sf !=null && sf2!=null)

{
req.setEndpoint(sf.SettingValue__c+'/salesforce/SalesForceFeed?oppid='+oppID+'&IsSanbox='+sf2.SettingValue__c);
}

req.setMethod('GET');

try
{
res = http.send(req);
string result = res.getBody();
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());

}
catch(System.CalloutException e)
{
System.debug('Callout error: '+ e);
System.debug(res.toString());
}

}

// run WebServiceCallout.testMe(); from Execute Anonymous to test
public static testMethod void testMe() {
WebServiceSalesforceFeed.HttpResult('006d0000006enVK');
}

}

 

 

The Test class

 

@isTest
private class WebServiceSalesFeedTest {

static testMethod void myUnitTest() {

Opportunity opp = new Opportunity();
opp.Name = 'Test Opp';
opp.StageName = 'To Be Searched';
opp.p1_First_Name__c ='A';
opp.p1_Last_Name__c ='D';
opp.p1_Gender__c = 'S';
opp.p1_First_Name__c ='S';
opp.p1_Last_Name__c ='A';
opp.p1_Gender__c = 'D';
opp.DOB_Main_Passenger__c = System.now().date();
opp.Number_of_Passengers__c = 4;
opp.CloseDate = System.now().date();
opp.Departure_Date__c = System.now().date();
opp.Origin_City__c = 'DEL';
opp.Destination_City__c= 'MUI';
opp.Return_Date__c = System.now().date();
opp.AmMessage__c ='testttt';

insert opp;

SalesForceUrl__c sf = new SalesForceUrl__c();
sf.Name ='AMUrl';
sf.SettingValue__c ='test';
insert sf;
SalesForceUrl__c sf2 = new SalesForceUrl__c();
sf2.Name ='IsSandBox';
sf2.SettingValue__c ='test';
insert sf2;

WebServiceSalesforceFeed obj = new WebServiceSalesforceFeed();
WebServiceSalesforceFeed.HttpResult(opp.Id);
WebServiceSalesforceFeed.testMe();
}
}

 

 

As this is custom setting object

 

 SalesForceUrl__c sf = new SalesForceUrl__c(); 

having SettingValue__c is custom fieild.

and two values Name = "amurl" and "SettingValue" having some value

 two values Name = "amurl" and "IsSandBox" having some value

,As i used this  in above code as shown in green line above.

 

 

Please guide me how can i achieve 100% for this class as it was about 80 % covered before i added green lines but i need this.

 

 

Thanks

 

 

 

 

Hi every one .

 

 i am getting the error  "System.NullPointerException:Attempt to de-reference a null object" while runing a test case.

 

The below is my Class: i am getting error in red line below:

 

public class FFtestPage {

FFtest__c FF;
public List<Opportunity> listOpp;
public String Id {get; set;}
public Opportunity Opp {get; set;}
public String Msg {get; set;}
public static boolean isApexTest = false;
//boolean flag = false;
public FFtestPage(ApexPages.StandardController stdController)
{
FF = (FFtest__c)stdController.getRecord();
Id = FF.Opportunity__c;

}

public PageReference Save()
{

try
{
if(FF.Id == null)
{
string obj = main(FF.Opportunity__c,FF.Id,FF.FFGuid__c,FF.Account_Number__c,FF.Account_Type__c,FF.Last_Name__c,FF.Miles__c,FF.Password__c,'add');
// if(obj.contains('success'))
if(obj.contains('success')|| obj=='success')
{
System.debug('*************Railsobj*********'+obj);
string[] parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}
System.debug('*************Guid*********'+FF.FFGuid__c);
insert FF;
System.debug('insert');
// ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, parts[0]));
PageReference pr = new PageReference('https://c.cs9.visual.force.com/apex/FFTestPAge?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
pr.setRedirect(true);
pr.getParameters().put('paramName', 'Saved Successfully');
return pr;

}
else
{
System.debug('notinsert');
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, obj));
// PageReference pr = new PageReference('https://c.na14.visual.force.com/apex/FFPage?retURL='+Id);
//pr.setRedirect(true);
// pr.getParameters().put('paramName', obj);
// return pr;

}

}
else
{
string obj = main(FF.Opportunity__c,FF.Id,FF.FFGuid__c,FF.Account_Number__c,FF.Account_Type__c,FF.Last_Name__c,FF.Miles__c,FF.Password__c,'update');
if(obj.contains('success')|| obj=='success')
{
string[] parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}
System.debug('*************Guidupdate*********'+FF.FFGuid__c);
update FF;
System.debug('update');
//ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, obj));
PageReference pr = new PageReference('https://c.na14.visual.force.com/apex/FFTestPAge?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
pr.setRedirect(true);
pr.getParameters().put('paramName', 'Updated Successfully');
return pr;
}
else
{
System.debug('notupdate');
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, obj));
//PageReference pr = new PageReference('https://c.na14.visual.force.com/apex/FFPage?id='+FF.Id+'&retURL='+Id+'&sfdc.override=1');
// pr.setRedirect(true);
// pr.getParameters().put('paramName', obj);
// return pr;
}

}

}

catch(DmlException ex)
{

}
return null;
}
public String main(String opid,String ffid,String guid,String actnu,String acttype,String lastn,Decimal miles,String pwd,String action)
{

SalesForceUrl__c sf = SalesForceUrl__c.getValues('AMUrl');
SalesForceUrl__c sf2 = SalesForceUrl__c.getValues('IsSandBox');
// Do a whole bunch of stuff

// Build the http request
HttpRequest req = new HttpRequest();
Http h = new Http();
if(sf != null && sf2 != null)
{
req.setEndpoint(sf.SettingValue__c+'/Abc/test?oppid='+ opid+'&ffid='+ffid+'&guid='+guid +'&acctnu='+actnu +'&accttype='+acttype+'&lastname='+lastn+'&miles='+miles+'&pwd='+pwd+'&actionType='+action+'&IsSandbox='+sf2.SettingValue__c);
}
req.setMethod('GET');

// Invoke web service call
String result = '';
if (!isApexTest){
// Make a real callout since we are not running a test
HttpResponse res = h.send(req);
result = res.getBody();
System.debug('Result=' +result);
System.debug('STATUS:'+res.getStatus());
} else {
// A test is running
result = 'success';
}

// Do whole bunch of stuff

return result;
}


// Wrapper method for "main" that we will call in the Test Class
public String mainForTest(){
isApexTest = true;
DateTime dT = System.now();
Decimal i = 1.2;
return main('006d0000007jfwO','a00d000000560NZ','a00d000000560NZ','11','AA','aa',i,'asd','add');
}
public PageReference Cancel()
{

PageReference pr = new PageReference('/' + Id);
pr.setRedirect(true);
return pr;
}
}

 

 

My test Class is:

 

@isTest
private class FFtestPagetestcase {

static testMethod void myUnitTest() {
FFtest__c FF;
List<Opportunity> listOpp;
List<FFtest__c> listFF;
String Id;
String result;
String webresult;
String webresultu;

string obj = '';
List<String> parts;


Opportunity opp = new Opportunity();
opp.Name = 'Test Opp';
opp.StageName = 'Ticketing';
opp.p1_First_Name__c ='A';
opp.p1_Last_Name__c ='D';
opp.p1_Gender__c = 'S';
opp.p1_First_Name__c ='S';
opp.p1_Last_Name__c ='A';
opp.p1_Gender__c = 'D';
opp.DOB_Main_Passenger__c = System.now().date();
opp.Number_of_Passengers__c = 4;
opp.CloseDate = System.now().date();
opp.Departure_Date__c = System.now().date();
opp.Origin_City__c = 'DEL';
opp.Destination_City__c= 'MUI';
opp.Return_Date__c = System.now().date();
opp.Override_Itinerary_Builder__c = true;
opp.Complete_Itinerary_Information__c ='test';
opp.Approved__c ='Test1';
opp.AmMessage__c ='success';
insert opp;

FF = new FFtest__c();
FF.Account_Number__c ='1234456';
FF.Account_Type__c = 'ANA';
FF.DOB__c = system.today();
FF.Opportunity__c = opp.Id;
FF.Last_Name__c = 'Dutt';
FF.Miles__c = 1.2;
FF.Password__c= 'asd';
FF.FFGuid__c ='hhhhdofhff';
webresult = 'success';
obj = 'Success,785765876';
parts = obj.split(',');
if(parts.size()>1)
{
FF.FFGuid__c = parts[1];
}

insert FF;
opp.StageName = 'FF Account Assigned';
update opp;


webresultu = 'success';
update FF;

try
{
ApexPages.StandardController sc = new ApexPages.StandardController(FF);
FFtestPage sc1 = new FFtestPage(sc);


String retVal = sc1.mainForTest();
// Add asserts for validation
String expectedResult = 'success';
System.assertEquals(retVal, expectedResult);
sc1.Save();


FFtest__c FF2 = new FFtest__c();
FF2.Account_Number__c ='1234456';
FF2.Account_Type__c = 'ANA';
FF2.DOB__c = system.today();
FF2.Opportunity__c = opp.Id;
FF2.Last_Name__c = 'Dutt';
FF2.Miles__c = 1.2;
FF2.Password__c= 'asd';
FF.FFGuid__c ='hhhhdofhff';
webresult = 'success';
insert FF2;
SalesForceUrl__c sf = SalesForceUrl__c.getValues('AMUrl');
sf.Name='AMUrl';

insert sf;
SalesForceUrl__c sf2 = SalesForceUrl__c.getValues('IsSandBox');
sf2.Name='IsSandBox';

insert sf2;
sc1.Cancel();
}

catch(System.CalloutException e)
{
webresult = e.getMessage();
}
System.assertEquals(webresult,'success');

}
}

 

 

please guide me where i am going wrong.

 

 

thanks

HI everyone

 

i have one validation rule like below

 

MONTH(CloseDate) < MONTH(TODAY())

 

it works fine but i need it to fire only for a new opportunities not for old.

 

for that purose i did this

 

AND( 
Id =='0', 
MONTH(CloseDate) < MONTH(TODAY()) 

)

 

but it not work .

 

please guide me what can i do to achieve this.

 

 

Thanks.