• Anil Dutt
  • NEWBIE
  • 150 Points
  • Member since 2012

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 68
    Replies

Hi,

I am using the Ruby Gem "databascdotcom" to integrate Salesforce in a Rails app and all works fine until i try it with sandbox account type "Configuration Only".

when i try to use it with salesforce sandbox account with username like "foo@bar.com.sandbox" I m getting following error "expired access/refresh token"

Any ideas?

Hi,

 

I have a situation where i m returing comma seperated string from a function and want to split this string in an array.

Here is what i m doing on Button click javascript but its gives me an error "message.Split is not a function"

 

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

var oppId= "{!Opportunity.Id}";

var message= sforce.apex.execute("CreditMemo","CloneOpp",{oppId:oppId });

var result = message.Split(",");
var newOppId ='';

if (result.length > 0)
{
   newOppId= result[1];
}

 

alert(result[0]);

if(result[0]== 'Success')
{
   window.location="https://na14.salesforce.com/"+newOppId;

}

 

Any idea?

Hi,

 I m in a situation where i need to insert Opportunity first then make a callout to do some operation. I created a Custom Button and Execute Javascript on its click.

Here is my Apex class

 global class CreditMemo {
    Webservice static string CloneOpp(string oppId)
    {
      string message = '';
      try  
    {
        List<Opportunity> listOpp = new List<Opportunity>();
       Opportunity oppOld = [SELECT Name FROM Opportunity WHERE Id = :oppId];
      Opportunity oppNew    = oppOld.clone(false, false);
      oppNew.Name = 'CLONED - ' + oppOld.Name;
          insert oppNew;

  HttpRequest req = new HttpRequest();
          HttpResponse res = new HttpResponse();
          Http http = new Http();
          req.setEndpoint('http://test.com/salesforce/TransactionFromCreditMemo?oppid='+oppID);
          req.setMethod('GET');
          res = http.send(req);
          string result = res.getBody();
}
}

Above method return foloowing error : You have uncommitted work pending. Please commit or rollback before calling out

Then i use Future Method

@future (callout =true)
      public static void HttpResult(String oppID) {
          HttpRequest req = new HttpRequest();
          HttpResponse res = new HttpResponse();
          Http http = new Http();
          req.setEndpoint('http://test.com/salesforce/TransactionFromCreditMemo?oppid='+oppID);
          req.setMethod('GET');
        try
          {
              res = http.send(req);
              string result = res.getBody();
              Opportunity opp = [SELECT ID,AmMessage__c FROM Opportunity WHERE Id = :oppID];
        opp.AmMessage__c = result;
             Database.update(opp);
         }
}

But as we can not return message from Future method, i try to update a filed in Opportunity to get message but found that Future Method is Asyncronus , getting data from Opportunity after calling Future Method does not get updated data.

I need to call Callout after Opportunity insert only as i needed new Id in Callout function and also need to get message from Webrequest.

Please suggest how can i achieve this

Thanks

Hi All,

 

can i use an apex component in opportunity standard page?

 

My problem is, I want to show an HTML Markup in readonly format in Opportunity page layout, not able to find any solution on this.

 

Please guide

 

Thanks

HI,

 

i m using Ruby Gem "Databascdotcom" to integrate Salesforce in ROR and all works fine.

But getting following error on first call to salesfroce

**The requested resource does not exist**

If i refresh(Ctrl + F5) page again , it work fine without any error.

Here is my code

    def SalesForceFeed
      @oppID = params[:oppid]

    client = Databasedotcom::Client.new client.client_id #=> foo client.client_secret #=> bar
    client.authenticate :username => "foo@bar.com", :password => "ThePasswordTheSecurityToken" #=> "the-oauth-token"
    client.materialize("Opportunity")
      begin
          @client=SalesForce::Connection.new.client
          @opp = Opportunity.find_by_Id(@oppID)
      rescue Exception=>e
        if(e.message == "The requested resource does not exist")
          return redirect_to :action => 'SalesForceFeed', :oppid => @oppID
        end
      end   

On first call to "SalesForceFeed" return error "The requested resource does not exist", so add a excepton check and call "SalesForceFeed" again, but i know this is not the right way.

So please suggest me a better way to fix this
Thanks

 

Hi,

i want to make a HTTP Post request from Apex class to send an complete Opportunity object to my remote site Action

Here is my code

 Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://itinerary.swiftsetup.com/ItineraryBuilder/SendItineraryEmail?op='+Opp);
req.setMethod('Post');
HttpResponse res = h.send(req);
 result = res.getBody();

but getting following error

Invalid HTTP method: Post

Thanks for your help

Hi,

I have a Rails 3.1 application , in this app i want to get salesforce opportunity data. I m new to rails not sure how to incluce Salesforce API in Rails.

I want to do something like adding webreference in .Net and using that reference i can access any salesforce object and query any data.

I want to do same in Rails app, access any salesforce objet and query data

How can i acheive this?

Any help would be appreciated,

thanks

Hi,

I m trying to get Opportunity data and all its related list in a .Net Application. I have added Salesforce web reference in .Net application and using following query to get it.

List<Opportunity> listopportinities = new List<Opportunity>();
                string orsql = @"SELECT
                                    opr.OwnerId,  opr.Complete_Itinerary_Information__c
                                    FROM Opportunity opr where opr.Id ='" + opportunityId + "'";

                listopportinities = api.GetOpportunities(orsql);

E_Ticket__c is related list in opportunity, and i have around 10 such lists. I get it like this
    orsql = @"select Name, Passenger_Name__c, E_Ticket__c, Airline__c
                                            From E_Ticket__c where Opportunity__c = '" + opportunityId + "' order by Name asc ";
                List<E_Ticket__c> listEt = api.GetETickets(orsql);
                ViewBag.ETickets = listEt;

I don't want to execute seperate SOQL for each related list.
Is there any better way to get Opportunity data and all its related list in one SOQL query?

Thanks for any help.

Hi,

I have a custom object which has a field Name datatype AutoNumber. I used Component to show redcors in VF,  when i fetch records and sort it on Name asc records has different order as in List presented in Opportunity page. List has Sort By: --Default-- and is not in sorted order, it seems random

List in Opportunity shows Like this

Airlien  Name                                                  E-Ticket#

Air India                                                           1118

Kingfisher                                                        1115

Indigo                                                               1116

Spice Jet                                                         1117

Jet Airways                                                      1119

So not sure on which field data is sorted

so the problem is what is the default sort order got any list?

I hope i explained my point

Thaks in advance

Hi, Please help on writing test case to get 100% code coverage . Lines in Red not covered

 

Here is the Apex class

 

public with sharing class TestFlighRequestPage {
    Test_Flight_Request__c fr;
     public List<Opportunity> listOpp;
     public String Id  {get; set;}
     private string result;
    
    public TestFlighRequestPage(ApexPages.StandardController stdController)
    {
        fr = (Test_Flight_Request__c)stdController.getRecord();
        
        if(fr.Id == null)
            Id = ApexPages.currentPage().getParameters().get('opp');
        else
            Id = fr.Opportunity__c;
        
        listOpp = [SELECT id ,Name, Departure_Date__c,Number_of_Passengers__c,Destination_Zone__c,Return_Date__c,
                    Origin_City__c,Destination_City__c,Flexibility_From__c,Flexibility_To__c
                 FROM Opportunity WHERE Id = :Id];
        
        if(listOpp.size() >0)
        {
            if(fr.Opportunity__c  == null)
            {
                fr.Opportunity__c  =  listOpp[0].Id;
            }
            if (fr.From__c == null)
            {
                fr.From__c = listOpp[0].Origin_City__c;
            }
            if (fr.To__c == null)
            {
                fr.To__c = listOpp[0].Destination_City__c;
            }
            if (fr.Outbound_del__c == null)
            {
                fr.Outbound_del__c = listOpp[0].Departure_Date__c;
            }
            if (fr.Pax_del__c == null)
            {
                fr.Pax_del__c = listOpp[0].Number_of_Passengers__c;
            }
            if (fr.Region_del__c == null)
            {
                fr.Region_del__c = listOpp[0].Destination_Zone__c;
            }
            if (fr.Inbound_del__c == null)
            {
                fr.Inbound_del__c = listOpp[0].Return_Date__c;
            }
            if (fr.Outbound_Flexibility__c == null)
            {
                fr.Outbound_Flexibility__c = listOpp[0].Flexibility_From__c;
            }
            if (fr.Inbound_Flexibility__c == null)
            {
                fr.Inbound_Flexibility__c = listOpp[0].Flexibility_To__c;
            }
        }
    }
    
    public PageReference Save()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
          {
                ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/'+  Id);
        pr.setRedirect(true);
        return pr;
    }
    
    public PageReference SaveAndNew()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
   
     public void SendItineryEmail()
     {
          Http h = new Http();
         HttpRequest req = new HttpRequest();
        req.setEndpoint('http://itinerary.swiftsetup.com/ItineraryBuilder/GetCustomerView?opportunityId='+fr.Opportunity__c+'&flightRequestID='+fr.Id);
        req.setMethod('GET');
           
        HttpResponse res = h.send(req);
        result = res.getBody();
        String[] toaddress = new String[]{};
        toaddress.add('anil@swiftsetup.com');
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toaddress);
        mail.setSubject('Flight Stat');
        mail.setHtmlBody(result);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        
     }
    
     public PageReference CloneFlightRequest()
    {
        try
        {
            Test_Flight_Request__c clFR = new Test_Flight_Request__c();
            Test_Flight_Request__c oldFR = [SELECT From__c, To__c,Outbound_del__c,Pax_del__c,Region_del__c,        
                    Inbound_del__c,Outbound_Flexibility__c,Inbound_Flexibility__c,Opportunity__c,
                    Budget__c,Publish_Fare__c
                 FROM Test_Flight_Request__c WHERE Id = :fr.Id];

            clFR.From__c = oldFR.From__c;
            clFR.To__c = oldFR.To__c;
            clFR.Outbound_del__c = oldFR.Outbound_del__c;
            clFR.Pax_del__c = oldFR.Pax_del__c;
            clFR.Region_del__c = oldFR.Region_del__c;
            clFR.Inbound_del__c = oldFR.Inbound_del__c;
            clFR.Outbound_Flexibility__c = oldFR.Outbound_Flexibility__c;
            clFR.Inbound_Flexibility__c = oldFR.Inbound_Flexibility__c;
            clFR.Opportunity__c = oldFR.Opportunity__c;
            clFR.Budget__c = oldFR.Budget__c;
            clFR.Publish_Fare__c = oldFR.Publish_Fare__c;    
            insert clFR;
            
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
}

Hi,

 

I have some fileds for Passenger like

 

p1_First_Name__c , p1_Last_Name__c

p2_First_Name__c , p2_Last_Name__c

p3_First_Name__c , p3_Last_Name__c

 

I want to create a Formula Filed which return value on following condition

 

int i =0;

if(p1_First_Name__c !=null && p1_Last_Name__c !=null)

then  i = i +1;

if(p2_First_Name__c !=null && p2_Last_Name__c !=null)

then i= i +1;

 

and so on

 

So of all filed are not null then total of 4 value will return

If 3 fileds  not null then value will be 3

 

Please help

 

Thanks

Hi,

 

I have a iFrrame in my VF page

 

<apex:iframe id="theIframe" src="http://test.com?opportunityId={!Test_Flight_Request__c.Opportunity__c}&flightRequestID={!Test_Flight_Request__c.id}&passengers={!Test_Flight_Request__c.Pax_del__c}" width="1500px" height="600px" scrolling="true" />

 

Test_Flight_Request__c.Pax_del__c has data type Number and so it has value Like 2.0

 

Because of decimal number this value does not pass in query string

 

How can i remove Decimal number from 2.0 in VF page?

 

Thanks for any help

Any one help me  writing Test Case for folowing Trigger for 100 % code coverage

 

trigger ConfirmationEmailContentTrigger on Opportunity (after insert) {
  List<Opportunity> listOpp = new List<Opportunity>();
    for (Opportunity op: trigger.new)
    {
        Opportunity oppNew = [SELECT Id, Confirmation_Email_Content__c FROM Opportunity WHERE Id =:op.Id];
        
        oppNew.Confirmation_Email_Content__c = '<p>I am pleased to inform you that your flights have been ticketed. Our ticketing department has also completed your seat assignments and confirmed any special requests that you have brought to my attention.</p>';
       
         if(op.AccountId != null)
    {
         Account acc =  [SELECT Id FROM Account WHERE Id =:op.AccountId limit 1];
          if(acc != null)
          {
            Contact[] con =  [SELECT Id, Email FROM Contact WHERE AccountId =:acc.id order by CreatedDate asc limit 1];
            if (con.size() > 0)
            {
              oppNew.Email__c = con[0].Email;
              oppNew.Notification_Email_Address__c = con[0].Email;
            }
          }
         }  
        listOpp.add(oppNew);
    }
    if (listOpp != null && !listOpp .isEmpty())
    {
       Database.update(listOpp);
    }
}

 

Thanks in advance

Hi All,

I have two triggers for two different Objects

trigger AirlineConfAirlineUrlTrigger on Airline_Conf__c (before insert, before update) {
  for(Airline_Conf__c ac : Trigger.New)
    {
      ac.Airlines_Url__c = '';
        if(ac.Airline__c =='Virgin Australia')
        {
            ac.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin Australia</a>';
        }
    }
}

trigger ETicketAirlineUrlTrigger on E_Ticket__c (before insert, before update) {
    for(E_Ticket__c etNew : Trigger.New)
    {
      etNew.Airlines_Url__c = '';
        if(etNew.Airline__c =='Virgin Australia')
        {
            etNew.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin  Australia</a>';
        }
    }
}

both above triggers does same thing but on different Objects.

I need above trigger to use a component (if possible) or someting , so for any future changes , i only have to change it in one place and so it will refelect in both triggers

Any help would be appreciated

Thanks

Hi,

 

I have a custom object which has a field Name datatype AutoNumber. The data display in the list has different order . when i fetch records and sort it on Name asc record comes in same order but in List presented in salesforce has Sort By: --Default-- and is not in sorted order, it seems random

 

List in Salesforce shows Like this

 

Airlien  Name                                                  E-Ticket#

Air India                                                           1118

Kingfisher                                                        1115

Indigo                                                               1116

Spice Jet                                                         1117

Jet Airways                                                      1119

 

 

So not sure on which field data is sorted

 

For explanationi added E-Ticket number here, i have not included it in the actuall list, if include yes i can set sort by to this coulmn but i can't show this fiedl in list.

 

I hope i explained my point

 

Thaks in advance

Hi,

I have created a Visual Force page with following extension class

public class FlighRequestPage {
  Flight_Request__c fr;
  Opportunity opp;
  public FlighRequestPage(ApexPages.StandardController stdController)
    {
      fr = (Flight_Request__c)stdController.getRecord();
      opp = [SELECT id , Departure_Date__c   FROM Opportunity WHERE Id = :fr.Opportunity__c];
    if (fr.Outbound_del__c == null)
      {
        fr.Outbound_del__c = opp.Departure_Date__c;
      }
    }
    
    public PageReference Save()
    {
        try
        {
        insert fr;
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/'+  fr.Opportunity__c);
        pr.setRedirect(true);
        return pr;
    }
}

but getting following error

Id value 006d0000005nU0D is not valid for the Flight_Request__c standard controller

Any help would we apprediated

Thanks

Hi,

I have override New and Edit buttons to use Visual Force page for Custom Object Itinerary
and VF Page uses following class as Extension {extensions="ItinerarySave"}
public class ItinerarySave {

   Itinerary__c it;
  Opportunity opp;
  public ItinerarySave(ApexPages.StandardController stdController)
    {
       it = (Itinerary__c)stdController.getRecord();
       if(it.Id != null )
        {
            it = [SELECT id , Email_To__c,Opportunity__c FROM Itinerary__c WHERE Id = :it.Id];
        }
        opp = [SELECT id , Email__c FROM Opportunity WHERE Id = :it.Opportunity__c];
     if (it.Email_To__c == null)
      {
         it.Email_To__c = opp.Email__c;
      }
    }
    public PageReference Save()
    {
       if(it.Id != null)
       {
             update it;
       }
       else
       {
          insert it;       

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

But record not update, insert working fine

Please help me on this how to fix

Thanks

Hi,

i want to add an IF conditon to do not include some data in Visualforce Email Template

    <apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}">     
          {!IF(!cx.Include_in_Confirmation__c == true}
{
          <tr>        
              <td  style="text-align:left;float:left;" width="195">
                   <apex:outputText value="{!cx.Airlines_Url__c}" escape="false" />
              </td>
             <td width="195" style="text-align:left;float:left;">{!cx.Conf__c}</td>
         </tr>
}
    </apex:repeat>

Is this posiible?

Thanks

Hi,

i have set a BCC address like this but it does not go out

     Contact con1 =  new Contact();
     con1.FirstName = 'Anil';
     con1.LastName = 'Dutt';
     con1.Email = 'anil@swiftsetup.com';
     insert con1;
                      
     Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
     mail1.setTargetObjectId(con1.Id);
     mail1.setWhatId(opp.Id);
     mail1.setTemplateId('00Xd0000000PJGH');
     String[] bccEmail = new String[]{'anildbest83@gmail.com'};
     mail1.setBccAddresses(bccEmail);
     mail1.setOrgWideEmailAddressId('0D2d00000004D3Z');
     Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail1 });
     delete con1;

Mail goes to anil@swiftsetup.com but not to anildbest83@gmail.com

Any idea?

Hi,

i have a visualforce page and  want to auto pouplate a filed

<apex:page standardController="Itinerary__c" tabStyle="Itinerary__c" extensions="ItinerarySave">
    <apex:form >
        <apex:pageBlock title="Itinerary Edit" mode="edit">
            <apex:inputField label="Email To" value="{!email}" required="true"/>
         </apex:pageBlock>
    </apex:form>
</apex:page>


Apex class is

public class ItinerarySave {
    
    Itinerary__c it;
    public String email {get; set;}

    public ItinerarySave(ApexPages.StandardController stdController)
    {
        email = 'anil@swiftsetup.com';
    }

but it gives following error

Error: Could not resolve the entity from <apex:inputField> value binding '{!email}'. <apex:inputField> can only be used with SObject fields.

Please help

Thanks

Hi,

 

I have a situation where i m returing comma seperated string from a function and want to split this string in an array.

Here is what i m doing on Button click javascript but its gives me an error "message.Split is not a function"

 

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

var oppId= "{!Opportunity.Id}";

var message= sforce.apex.execute("CreditMemo","CloneOpp",{oppId:oppId });

var result = message.Split(",");
var newOppId ='';

if (result.length > 0)
{
   newOppId= result[1];
}

 

alert(result[0]);

if(result[0]== 'Success')
{
   window.location="https://na14.salesforce.com/"+newOppId;

}

 

Any idea?

Hi All,

 

can i use an apex component in opportunity standard page?

 

My problem is, I want to show an HTML Markup in readonly format in Opportunity page layout, not able to find any solution on this.

 

Please guide

 

Thanks

Hi,

I have a Rails 3.1 application , in this app i want to get salesforce opportunity data. I m new to rails not sure how to incluce Salesforce API in Rails.

I want to do something like adding webreference in .Net and using that reference i can access any salesforce object and query any data.

I want to do same in Rails app, access any salesforce objet and query data

How can i acheive this?

Any help would be appreciated,

thanks

Hi,

I m trying to get Opportunity data and all its related list in a .Net Application. I have added Salesforce web reference in .Net application and using following query to get it.

List<Opportunity> listopportinities = new List<Opportunity>();
                string orsql = @"SELECT
                                    opr.OwnerId,  opr.Complete_Itinerary_Information__c
                                    FROM Opportunity opr where opr.Id ='" + opportunityId + "'";

                listopportinities = api.GetOpportunities(orsql);

E_Ticket__c is related list in opportunity, and i have around 10 such lists. I get it like this
    orsql = @"select Name, Passenger_Name__c, E_Ticket__c, Airline__c
                                            From E_Ticket__c where Opportunity__c = '" + opportunityId + "' order by Name asc ";
                List<E_Ticket__c> listEt = api.GetETickets(orsql);
                ViewBag.ETickets = listEt;

I don't want to execute seperate SOQL for each related list.
Is there any better way to get Opportunity data and all its related list in one SOQL query?

Thanks for any help.

Hi,

I have a custom object which has a field Name datatype AutoNumber. I used Component to show redcors in VF,  when i fetch records and sort it on Name asc records has different order as in List presented in Opportunity page. List has Sort By: --Default-- and is not in sorted order, it seems random

List in Opportunity shows Like this

Airlien  Name                                                  E-Ticket#

Air India                                                           1118

Kingfisher                                                        1115

Indigo                                                               1116

Spice Jet                                                         1117

Jet Airways                                                      1119

So not sure on which field data is sorted

so the problem is what is the default sort order got any list?

I hope i explained my point

Thaks in advance

Hi, Please help on writing test case to get 100% code coverage . Lines in Red not covered

 

Here is the Apex class

 

public with sharing class TestFlighRequestPage {
    Test_Flight_Request__c fr;
     public List<Opportunity> listOpp;
     public String Id  {get; set;}
     private string result;
    
    public TestFlighRequestPage(ApexPages.StandardController stdController)
    {
        fr = (Test_Flight_Request__c)stdController.getRecord();
        
        if(fr.Id == null)
            Id = ApexPages.currentPage().getParameters().get('opp');
        else
            Id = fr.Opportunity__c;
        
        listOpp = [SELECT id ,Name, Departure_Date__c,Number_of_Passengers__c,Destination_Zone__c,Return_Date__c,
                    Origin_City__c,Destination_City__c,Flexibility_From__c,Flexibility_To__c
                 FROM Opportunity WHERE Id = :Id];
        
        if(listOpp.size() >0)
        {
            if(fr.Opportunity__c  == null)
            {
                fr.Opportunity__c  =  listOpp[0].Id;
            }
            if (fr.From__c == null)
            {
                fr.From__c = listOpp[0].Origin_City__c;
            }
            if (fr.To__c == null)
            {
                fr.To__c = listOpp[0].Destination_City__c;
            }
            if (fr.Outbound_del__c == null)
            {
                fr.Outbound_del__c = listOpp[0].Departure_Date__c;
            }
            if (fr.Pax_del__c == null)
            {
                fr.Pax_del__c = listOpp[0].Number_of_Passengers__c;
            }
            if (fr.Region_del__c == null)
            {
                fr.Region_del__c = listOpp[0].Destination_Zone__c;
            }
            if (fr.Inbound_del__c == null)
            {
                fr.Inbound_del__c = listOpp[0].Return_Date__c;
            }
            if (fr.Outbound_Flexibility__c == null)
            {
                fr.Outbound_Flexibility__c = listOpp[0].Flexibility_From__c;
            }
            if (fr.Inbound_Flexibility__c == null)
            {
                fr.Inbound_Flexibility__c = listOpp[0].Flexibility_To__c;
            }
        }
    }
    
    public PageReference Save()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
          {
                ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/'+  Id);
        pr.setRedirect(true);
        return pr;
    }
    
    public PageReference SaveAndNew()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
   
     public void SendItineryEmail()
     {
          Http h = new Http();
         HttpRequest req = new HttpRequest();
        req.setEndpoint('http://itinerary.swiftsetup.com/ItineraryBuilder/GetCustomerView?opportunityId='+fr.Opportunity__c+'&flightRequestID='+fr.Id);
        req.setMethod('GET');
           
        HttpResponse res = h.send(req);
        result = res.getBody();
        String[] toaddress = new String[]{};
        toaddress.add('anil@swiftsetup.com');
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toaddress);
        mail.setSubject('Flight Stat');
        mail.setHtmlBody(result);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        
     }
    
     public PageReference CloneFlightRequest()
    {
        try
        {
            Test_Flight_Request__c clFR = new Test_Flight_Request__c();
            Test_Flight_Request__c oldFR = [SELECT From__c, To__c,Outbound_del__c,Pax_del__c,Region_del__c,        
                    Inbound_del__c,Outbound_Flexibility__c,Inbound_Flexibility__c,Opportunity__c,
                    Budget__c,Publish_Fare__c
                 FROM Test_Flight_Request__c WHERE Id = :fr.Id];

            clFR.From__c = oldFR.From__c;
            clFR.To__c = oldFR.To__c;
            clFR.Outbound_del__c = oldFR.Outbound_del__c;
            clFR.Pax_del__c = oldFR.Pax_del__c;
            clFR.Region_del__c = oldFR.Region_del__c;
            clFR.Inbound_del__c = oldFR.Inbound_del__c;
            clFR.Outbound_Flexibility__c = oldFR.Outbound_Flexibility__c;
            clFR.Inbound_Flexibility__c = oldFR.Inbound_Flexibility__c;
            clFR.Opportunity__c = oldFR.Opportunity__c;
            clFR.Budget__c = oldFR.Budget__c;
            clFR.Publish_Fare__c = oldFR.Publish_Fare__c;    
            insert clFR;
            
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
}

Hi,

 

I have some fileds for Passenger like

 

p1_First_Name__c , p1_Last_Name__c

p2_First_Name__c , p2_Last_Name__c

p3_First_Name__c , p3_Last_Name__c

 

I want to create a Formula Filed which return value on following condition

 

int i =0;

if(p1_First_Name__c !=null && p1_Last_Name__c !=null)

then  i = i +1;

if(p2_First_Name__c !=null && p2_Last_Name__c !=null)

then i= i +1;

 

and so on

 

So of all filed are not null then total of 4 value will return

If 3 fileds  not null then value will be 3

 

Please help

 

Thanks

Hi,

 

I have a iFrrame in my VF page

 

<apex:iframe id="theIframe" src="http://test.com?opportunityId={!Test_Flight_Request__c.Opportunity__c}&flightRequestID={!Test_Flight_Request__c.id}&passengers={!Test_Flight_Request__c.Pax_del__c}" width="1500px" height="600px" scrolling="true" />

 

Test_Flight_Request__c.Pax_del__c has data type Number and so it has value Like 2.0

 

Because of decimal number this value does not pass in query string

 

How can i remove Decimal number from 2.0 in VF page?

 

Thanks for any help

Hi,

 

Is there any way we can log Activities from some custom button which send email?

 

Log an Activity when an email is sent from a custom button

My custom button not only send email but do few more things, i called a apex class from custom button to do all the stuff, now want to log activity from same apex class

 

 

thanks