• Ashutosh (Independent SFDC Consultant)
  • NEWBIE
  • 0 Points
  • Member since 2014

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

 

We have an ecommerce site in php that builds some text string which is emailed to a custom email address in salesforce crm.

We need to make some changes in salesforce to exsiting customisation, so are looking for a certified salesforce expert. Please see an example of the information we are sending


title:".$ecustomer_title."
first_name:".$ecustomer_first_name."
last_name:".$ecustomer_last_name."
homeno:".$ecustomer_contact_number."
mobile:".$ecustomer_mobile_number."
email:".$ecustomer_email."
dob:".$dob22."
address1:".$ecustomer_address_line_1."
address2:".$ecustomer_address_line_2."
town:".$ecustomer_address_town."
county:".$ecustomer_address_county."
post_code:".$ecustomer_address_post_code."
reg_no:".$ecars_registration."
make:".$ecars_make."
model:".$ecars_model."
specification:".$ecars_specification."
style:".$ecars_body_type."
engine_cc:".$ecars_engine_size."
fuel_type:".$ecars_fuel_type."
transmission:".$ecars_transmission."
financed:".$ecars_finance."
vehicle_purchase_date:".$date_purchased22."
purchase_value:".$purchase_value."
first_registered_date:".$date_reg22."
current_mileage:".$current_mileage."
gap_policy_type:$title
gap_term:$term22
gap_claim_limit:£$claim_limit22
gap_price:$product_price
tyre_policy_type:Tyre Insurance
tyre_term:$term22
tyre_claim_limit:£$claim_limit22
tyre_price:$product_price
smart_policy_type:SMART Insurance
smart_term:$term22
smart_claim_limit:£$claim_limit22
smart_price:$product_price
        warranties_policy_type:$policy_type22
        warranties_term:$term22
        warranties_claim_limit:£$claim_limit22
        warranties_price:$price22
$email='accountcreation@c-2qwiliigfli50nsdsdtv3ygemjnmu.in.salesforce.com';
mail("$email","New Lead",$fields22,"From: mail@oursite.co.uk");

We would like to add some new fields as follows:

policy numbers, policy end dates, properly formatted numbers, custom field update

We are looking to work with a certified Salesforce developer who we can continue to work with on an adhoc basis for other tasks we have.

 

I'm currently trying to create a trigger that runs whenever an Opportunity is created or updated. The trigger needs to check all the other Opportunities related to the Account of the Opportunity being updated. It should check to see if any of the Opportunities have a StageName equal to 'Closed Won - One Time' or 'Closed Won - Recurring' and if so, it should update the account Type to 'Customer'. If none of the Opportunities are closed won, the Account Type should be 'Prospect'. 

This is the code I currently have but it doesn't seem to work. I'm not exactly sure how to check all the related opportunitites. 

trigger updateAccountIfOppCustomer on Opportunity (after insert, after update) {
    Map<Id, Account> accounts = new Map<Id, Account>();
    for (Opportunity opp : Trigger.new) {
        Account a = accounts.get(opp.AccountId);
        if (opp.StageName == 'Closed Won - One Time' || opp.StageName == 'Closed Won - Recurring') {
            if (a == null) {
                a = new Account(Id = opp.AccountId);
                accounts.put(opp.AccountId, a);
            }
            a.Type = 'Customer'; 
        } else {
            a.Type = 'Prospect';
        }
    }
    if (!accounts.isEmpty()) {
        update accounts.values();
    }
}

Any suggestions are appreciated! 
  • August 08, 2014
  • Like
  • 0