• Yamini Bathula
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 11
    Replies
Hi Guys,

We have a requirement to update a URL Field of Opportunity in Lead Conversion. I am doing this via APex Trigger. We need to update this URL with Different values in sandbox and Production. This URL is not Salesforce instance URL. This is a different application's URL which is different for testing and Production environments.

I can Update the field using Issandbox field in Organisation object. But my concern is it takes a couple of lines in my code. I would like to have it as a single line in my code. 

Can anyone help me achieve this with a single line of code?

Thanks,
Yamini.
Hi,

With salesforce pre chat form we can create a case automatically. But Can we just not create the case but open new case page with the pre chat form values prefilled in it? We want to let the agent create the case by them self with the contact name and email fields prefilled for them.

Is this possible?
Hi Guys,

We have reuirement to get the picklist values in a custom field usinf APIs.

I have tried this

 /services/data/v41.0/tooling/query?q=Select+MetaData+From+FieldDefinition+where+EntityDefinition.DeveloperName='Lead'+AND+FieldDefinition.QualifiedApiName='customfield Name'

But this is giving me a massive response to parse.

Is there any other easier way to do this?

Thanks,
Yamini.
Hi,

I have a query regarding force.com sites. I am new to force.com sites. Can we consume third party APIs from force.com site? If yes, can we store the API responses back in salesforce?

Thanks,
 
Hi All,

I have  reuirement to assign an array of strings to be assigned to 9 different custom text fields. This array of strings is a result from an API call. 

can anyone suggest me a way to do this using a loop instead of weriting 9 lines of assignment statements?

Thanks,
Yamini.
Hi Guys,

We have a before Update Trigger on Lead which fires on Lead conversion to check some mandatory values and just add error using Apex.adderror() method to display the error message to the user. This trigger is not firing for some users instead of trigger's error message they are getting an error message which is the result of a process builder which tries to update an Opportunity name when an Oporutnity is created. When I(system admin) login as them and try it is displaying the trigger's error message. 

I am not sure what is happening.

Does any one have any idea or had the same issue?

 
Hi Guys,

We have moved to Lightning recently. The issue is now with Lead Conversion. In lightning if users dont enter Opportunity name in conversion window then the Opporutnity is not created. So we wanted to automate opp creation if the user has missed populating the Opporutniy Name field. 
I wrote trigger for that and it is working fine. But the only issue is the newly created opporutnity  doesnt have any lead fields mapped from Lead as the standard Lead conversion do.

Soes nay one have any idea of how to achieve the Lead Field mapping in the trigger instead of writing assignment statements in the trigger?

Thanks,
Here is my trigger:
 
trigger LeadConversionOppCreation on Lead (after update) 
{
 if (Trigger.new.size() == 1) 
 {

    if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true)
    {
         if (Trigger.new[0].ConvertedAccountId != null) 
         {
              Account a = [Select a.Id, a.Description From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
              
              if (Trigger.new[0].ConvertedOpportunityId == null) 
                { 
                 Opportunity opp = new Opportunity();
                 opp.Name= Trigger.new[0].Trading_Name__c;
                 opp.StageName = 'Qualification' ;  
                 opp.CloseDate =  Date.today() + 14; 
                 opp.AccountId =  Trigger.new[0].ConvertedAccountId;
               /* I have commented out the assignment statements for now. If I go with this way then every time a new field is added on to a lead then I have to update the trigger if we have to map it across to opportunity from Lead.
               opp.Xero_Payments__c =  Trigger.new[0].Xero_Accept_Payments__c; 
                 opp.API_Requested__c = Trigger.new[0].API_Requested__c;
                 opp.Avg_Trans_Value__c = Trigger.new[0].Avg_Trans_Amount__c;
                 opp.BPAY_Required__c = Trigger.new[0].BPAY_Requested__c;  
                 opp.Console_Gateway__c = Trigger.new[0].Console_Gateway__c;
                 opp.Lead_Countries__c = Trigger.new[0].Lead_Countries__c;
                 opp.Current_Processor__c =  Trigger.new[0].CurrentProcessor__c;
                 opp.Recurring_Required__c = Trigger.new[0].Direct_Debit_Requested__c;
                 opp.Real_Time_Required__c = Trigger.new[0].eCommerce__c;
                 opp.HPP_Requested__c = Trigger.new[0].HPP_Requested__c;
                 opp.Lead_Created_Date_and_Time__c = Trigger.new[0].  */
                     
                 insert opp;
                   
                    
                }
         }    
    }
 }    
}

 
Hi Guys,

We have a trigger on Lead Conversion which checks for some fields (if htey are blank) and display a error message in Convert Popup(in Lightining). That is working fine. But the only issue is the new line is not working in the UI.

Here is my trigger : I have added a new line every time I append the error string. but it doesn't show up in the conversion popup in Lightning. 
trigger MandatoryFieldsLeadConversion on Lead (before Update) 
{

           // Select Id,ParentAccount__c,FirstName,Email,Phone,Company,Country__c,Industry_Ipay__c,Trading_Name__c,Street,State,City,PostalCode,Sales_Channel__c,Avg_Trans_Amount__c,Trans_Per_Month__c,Max_Single_Pay_Amt__c,Director_1_First_Name__c,Director_1_Last_Name__c,Director_Email__c,Direct_Debit_Requested__c,eCommerce__c,Video_Payment__c,Xero_Payment_Now__c,Xero_Direct_Debit__c
        
        String sBreak = '<br/>';    
        Boolean hasError = false;
        for (Lead l : Trigger.new)
         {
            if (Trigger.oldMap.get(l.id).isConverted == false && Trigger.newMap.get(l.id).isConverted == true) // to check only in Lead Coversion
             {  
                 String erstring = 'Please Enter Below Mandatory Fields before converting this Lead \n';
               //Lead l = [Select Id,ParentAccount__c,FirstName,Email,Phone,Company,Country__c,Industry_Ipay__c,Trading_Name__c,Street,State,City,PostalCode,Sales_Channel__c,Avg_Trans_Amount__c,Trans_Per_Month__c,Max_Single_Pay_Amt__c,Director_1_First_Name__c,Director_1_Last_Name__c,Director_Email__c,Direct_Debit_Requested__c,eCommerce__c,Video_Payment__c,Xero_Payment_Now__c,Xero_Direct_Debit__c From Lead Where Id in  :trigger.new[i]];
                 //Skip this check for V3 and IODM Leads
               if((l.ParentAccount__c != '0019000001YHuxWAAT') && (l.ParentAccount__c != '0016F00001i2yYHQAY'))
                 { 
                     //if Parent Account is Blank
                   if((l.ParentAccount__c == null) || (l.ParentAccount__r.Name ==  ' '))
                   { 
                    erstring += '\n Parent Account' ; 
                    hasError = true; 
                   }
                     //if First Name is Blank
                   if((l.FirstName == null) || (l.FirstName ==  ' '))
                   {
                     erstring += '\nFirst Name'  ;
                     hasError = true; 
                   }
                     //if Email is Blank
                   if((l.Email == null) || (l.Email ==  ' '))
                   {
                     erstring += '\n Email';
                     hasError = true; 
                   }
                      //if Phone is Blank
                   if((l.Phone == null) || (l.Phone ==  ' '))
                   {
                     erstring += '\nPhone                          ';
                     hasError = true; 
                   }
                      //if Company is Blank
                   if((l.Company == null) || (l.Company ==  ' '))
                   {
                     erstring += 'Company \n';
                     hasError = true; 
                   }
                      //if Country is Blank
                   if((l.Country__c == null) || (l.Country__c ==  ' '))
                   {
                     erstring += 'Country \n';
                     hasError = true; 
                   } 
                      //if Industry is Blank
                   if((l.Industry_Ipay__c == null) || (l.Industry_Ipay__r.Name ==  ' '))
                   {
                     erstring += 'Industry \n';
                     hasError = true; 
                   }  
                      //if Parent Account is Blank
                   if((l.Trading_Name__c == null) || (l.Trading_Name__c ==  ' '))
                   {
                     erstring += 'Trading Name \n';
                     hasError = true; 
                   }
                      //if Address is Blank
                   if((l.Street == null) || (l.Street ==  ' '))
                   {
                     erstring += 'Street \n';
                     hasError = true; 
                   }
                    if((l.State == null) || (l.State ==  ' '))
                   {
                     erstring += 'State \n';
                     hasError = true; 
                   }
                   if((l.City == null) || (l.City ==  ' '))
                   {
                     erstring += 'City \n';
                     hasError = true; 
                   }   
                   if((l.PostalCode == null) || (l.PostalCode ==  ' '))
                   {
                     erstring += 'Post Code \n';
                     hasError = true; 
                   } 
                      //if Sales channel is Blank
                   if((l.Sales_Channel__c == null) || (l.Sales_Channel__c ==  ' '))
                   {
                     erstring += 'Sales Channel \n';
                     hasError = true; 
                   } 
                      //if Average Transaction Amount is Blank
                   if((l.Avg_Trans_Amount__c == null) || (l.Sales_Channel__c ==  ' '))
                   {
                     erstring += 'Average Transaction Amount \n';
                     hasError = true; 
                   } 
                      //ifTransactions per month is Blank
                   if((l.Trans_Per_Month__c == null) )
                   {
                     erstring += 'Transactions per month \n';
                     hasError = true; 
                   }
                      //if Max Singl ePay Amount is Blank
                   if((l.Max_Single_Pay_Amt__c == null))
                   {
                     erstring += 'Maximum single payment amount \n';
                     hasError = true; 
                   }
                      //ifDirector Details Blank
                   if((l.Director_1_First_Name__c == null) || (l.Director_1_First_Name__c ==  ' '))
                   {
                     erstring += 'Director First Name  \n';
                     hasError = true; 
                   } 
                   if((l.Director_1_Last_Name__c == null) || (l.Director_1_Last_Name__c ==  ' '))
                   {
                     erstring += 'Director Last Name  \n';
                     hasError = true; 
                   } 
                   if((l.Director_Email__c == null) || (l.Director_Email__c ==  ' '))
                   {
                     erstring += 'Director Last Name  \n';
                     hasError = true; 
                   } 
                      //if no products selected 
                   if(!((l.Direct_Debit_Requested__c) || (l.eCommerce__c) || (l.Video_Payment__c) || (l.Xero_Payment_Now__c) || (l.Xero_Direct_Debit__c) ))
                   {
                     erstring += 'One of the products Direct Debit Requested/Ecommerce/Video Payment/Xero Payment Now/Xero Direct Debit is not selected';
                     hasError = true; 
                   } 
                      //Finally add the error message if any of the fields above atre blank
                   if(hasError)
                   {
                     l.addError( erstring,false);
                   }
                  }
             }  
         }
}

Attached the popup screenshot. Does any one have any idea what is wrong?
User-added image
Hi,

We have a visualforce page in our salesforce org whose contoller class makes an API call and then display the result back on the page. This was placed on a record Detail page section in classic experince. It was working as expected. And we recently switched on Lightning Experience. The problem now is the visualforce page is working fine when the user clicks on command button in the page. It is getting the expected results. But it is gving an error when the user tries to update fields on the other sections after doing the API call(clicking the command button in the visualforce page).
This is the error:

This record was modified by USER during your edit session. Make a note of the data you entered, then reload the record and enter your updates again.

I am not sure what is causing this error.

Has anyone faced this issue?
It would be great if anyone can help.
Thanks,
Yamini.

 
Hi Guys,

I have visualforce page with Custom Components in it. My requirement now is to display a hover text on a custom field(with other Custom Text Field) in each component individually. Can any one let me know if this is achievable? If Yes, does that work in Lightning version? 
Hi guys,

Can anyone please provide me an example on how to call a apex controller method in a visualforce custom component using a command button?
Hi All,

We have a requirement to archive a custom object's Notes and Attachments (pdf Documents) in a local drice in our LAN. Can I know if this is possible? If yes can you guys guide me in the right direction?

 
Hi Guys,

we are planning to move to lightning next month. We do have a couple of javascript buttons on the classic version at the moment. I am looking for an alternative to a javascript button for lead conversion. That button checks for some mandatory fields on leads before converting a lead and displays an alert window to fill the mandatory fields.

Would you guys please help me with a lightning alternative for this?

 
Hi guys,

I have created a round robin lead assignment in salesforce using auto  number and then a formula on it to divide the auto number with number of users. But it is not evenly disctributing among the sales people as exoected. I want the round robin to work only on a subset of leads but not all. Is there any way to achieve this?

 
Hi,

With salesforce pre chat form we can create a case automatically. But Can we just not create the case but open new case page with the pre chat form values prefilled in it? We want to let the agent create the case by them self with the contact name and email fields prefilled for them.

Is this possible?
I am able to implement Platform Event within Salesforce object but I am looking for this implementation with External System. I have created an API in Ruby on Rails which load data into postgressql. I am calling this Rails API from Salesforce APEX class which is working fine but want to implement it with Salesforce platform event. Could you please help me how I can achive this functionality.

Scenario-
1. I have a Account object in Salesforce
2. Created a Platform event where data store once add any data into Account object
3. I could see Platform Evenet objetc is having required data
4. Now I want to push this data into RAILS API which will load into Heroku Postgressql. Please note, I am not looking this implementation with heroku Connect. Is there any way to implement this functionality with platform event?
Hi Guys,

We have a before Update Trigger on Lead which fires on Lead conversion to check some mandatory values and just add error using Apex.adderror() method to display the error message to the user. This trigger is not firing for some users instead of trigger's error message they are getting an error message which is the result of a process builder which tries to update an Opportunity name when an Oporutnity is created. When I(system admin) login as them and try it is displaying the trigger's error message. 

I am not sure what is happening.

Does any one have any idea or had the same issue?

 
Hi Guys,

We have moved to Lightning recently. The issue is now with Lead Conversion. In lightning if users dont enter Opportunity name in conversion window then the Opporutnity is not created. So we wanted to automate opp creation if the user has missed populating the Opporutniy Name field. 
I wrote trigger for that and it is working fine. But the only issue is the newly created opporutnity  doesnt have any lead fields mapped from Lead as the standard Lead conversion do.

Soes nay one have any idea of how to achieve the Lead Field mapping in the trigger instead of writing assignment statements in the trigger?

Thanks,
Here is my trigger:
 
trigger LeadConversionOppCreation on Lead (after update) 
{
 if (Trigger.new.size() == 1) 
 {

    if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true)
    {
         if (Trigger.new[0].ConvertedAccountId != null) 
         {
              Account a = [Select a.Id, a.Description From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
              
              if (Trigger.new[0].ConvertedOpportunityId == null) 
                { 
                 Opportunity opp = new Opportunity();
                 opp.Name= Trigger.new[0].Trading_Name__c;
                 opp.StageName = 'Qualification' ;  
                 opp.CloseDate =  Date.today() + 14; 
                 opp.AccountId =  Trigger.new[0].ConvertedAccountId;
               /* I have commented out the assignment statements for now. If I go with this way then every time a new field is added on to a lead then I have to update the trigger if we have to map it across to opportunity from Lead.
               opp.Xero_Payments__c =  Trigger.new[0].Xero_Accept_Payments__c; 
                 opp.API_Requested__c = Trigger.new[0].API_Requested__c;
                 opp.Avg_Trans_Value__c = Trigger.new[0].Avg_Trans_Amount__c;
                 opp.BPAY_Required__c = Trigger.new[0].BPAY_Requested__c;  
                 opp.Console_Gateway__c = Trigger.new[0].Console_Gateway__c;
                 opp.Lead_Countries__c = Trigger.new[0].Lead_Countries__c;
                 opp.Current_Processor__c =  Trigger.new[0].CurrentProcessor__c;
                 opp.Recurring_Required__c = Trigger.new[0].Direct_Debit_Requested__c;
                 opp.Real_Time_Required__c = Trigger.new[0].eCommerce__c;
                 opp.HPP_Requested__c = Trigger.new[0].HPP_Requested__c;
                 opp.Lead_Created_Date_and_Time__c = Trigger.new[0].  */
                     
                 insert opp;
                   
                    
                }
         }    
    }
 }    
}

 
Hi Guys,

We have a trigger on Lead Conversion which checks for some fields (if htey are blank) and display a error message in Convert Popup(in Lightining). That is working fine. But the only issue is the new line is not working in the UI.

Here is my trigger : I have added a new line every time I append the error string. but it doesn't show up in the conversion popup in Lightning. 
trigger MandatoryFieldsLeadConversion on Lead (before Update) 
{

           // Select Id,ParentAccount__c,FirstName,Email,Phone,Company,Country__c,Industry_Ipay__c,Trading_Name__c,Street,State,City,PostalCode,Sales_Channel__c,Avg_Trans_Amount__c,Trans_Per_Month__c,Max_Single_Pay_Amt__c,Director_1_First_Name__c,Director_1_Last_Name__c,Director_Email__c,Direct_Debit_Requested__c,eCommerce__c,Video_Payment__c,Xero_Payment_Now__c,Xero_Direct_Debit__c
        
        String sBreak = '<br/>';    
        Boolean hasError = false;
        for (Lead l : Trigger.new)
         {
            if (Trigger.oldMap.get(l.id).isConverted == false && Trigger.newMap.get(l.id).isConverted == true) // to check only in Lead Coversion
             {  
                 String erstring = 'Please Enter Below Mandatory Fields before converting this Lead \n';
               //Lead l = [Select Id,ParentAccount__c,FirstName,Email,Phone,Company,Country__c,Industry_Ipay__c,Trading_Name__c,Street,State,City,PostalCode,Sales_Channel__c,Avg_Trans_Amount__c,Trans_Per_Month__c,Max_Single_Pay_Amt__c,Director_1_First_Name__c,Director_1_Last_Name__c,Director_Email__c,Direct_Debit_Requested__c,eCommerce__c,Video_Payment__c,Xero_Payment_Now__c,Xero_Direct_Debit__c From Lead Where Id in  :trigger.new[i]];
                 //Skip this check for V3 and IODM Leads
               if((l.ParentAccount__c != '0019000001YHuxWAAT') && (l.ParentAccount__c != '0016F00001i2yYHQAY'))
                 { 
                     //if Parent Account is Blank
                   if((l.ParentAccount__c == null) || (l.ParentAccount__r.Name ==  ' '))
                   { 
                    erstring += '\n Parent Account' ; 
                    hasError = true; 
                   }
                     //if First Name is Blank
                   if((l.FirstName == null) || (l.FirstName ==  ' '))
                   {
                     erstring += '\nFirst Name'  ;
                     hasError = true; 
                   }
                     //if Email is Blank
                   if((l.Email == null) || (l.Email ==  ' '))
                   {
                     erstring += '\n Email';
                     hasError = true; 
                   }
                      //if Phone is Blank
                   if((l.Phone == null) || (l.Phone ==  ' '))
                   {
                     erstring += '\nPhone                          ';
                     hasError = true; 
                   }
                      //if Company is Blank
                   if((l.Company == null) || (l.Company ==  ' '))
                   {
                     erstring += 'Company \n';
                     hasError = true; 
                   }
                      //if Country is Blank
                   if((l.Country__c == null) || (l.Country__c ==  ' '))
                   {
                     erstring += 'Country \n';
                     hasError = true; 
                   } 
                      //if Industry is Blank
                   if((l.Industry_Ipay__c == null) || (l.Industry_Ipay__r.Name ==  ' '))
                   {
                     erstring += 'Industry \n';
                     hasError = true; 
                   }  
                      //if Parent Account is Blank
                   if((l.Trading_Name__c == null) || (l.Trading_Name__c ==  ' '))
                   {
                     erstring += 'Trading Name \n';
                     hasError = true; 
                   }
                      //if Address is Blank
                   if((l.Street == null) || (l.Street ==  ' '))
                   {
                     erstring += 'Street \n';
                     hasError = true; 
                   }
                    if((l.State == null) || (l.State ==  ' '))
                   {
                     erstring += 'State \n';
                     hasError = true; 
                   }
                   if((l.City == null) || (l.City ==  ' '))
                   {
                     erstring += 'City \n';
                     hasError = true; 
                   }   
                   if((l.PostalCode == null) || (l.PostalCode ==  ' '))
                   {
                     erstring += 'Post Code \n';
                     hasError = true; 
                   } 
                      //if Sales channel is Blank
                   if((l.Sales_Channel__c == null) || (l.Sales_Channel__c ==  ' '))
                   {
                     erstring += 'Sales Channel \n';
                     hasError = true; 
                   } 
                      //if Average Transaction Amount is Blank
                   if((l.Avg_Trans_Amount__c == null) || (l.Sales_Channel__c ==  ' '))
                   {
                     erstring += 'Average Transaction Amount \n';
                     hasError = true; 
                   } 
                      //ifTransactions per month is Blank
                   if((l.Trans_Per_Month__c == null) )
                   {
                     erstring += 'Transactions per month \n';
                     hasError = true; 
                   }
                      //if Max Singl ePay Amount is Blank
                   if((l.Max_Single_Pay_Amt__c == null))
                   {
                     erstring += 'Maximum single payment amount \n';
                     hasError = true; 
                   }
                      //ifDirector Details Blank
                   if((l.Director_1_First_Name__c == null) || (l.Director_1_First_Name__c ==  ' '))
                   {
                     erstring += 'Director First Name  \n';
                     hasError = true; 
                   } 
                   if((l.Director_1_Last_Name__c == null) || (l.Director_1_Last_Name__c ==  ' '))
                   {
                     erstring += 'Director Last Name  \n';
                     hasError = true; 
                   } 
                   if((l.Director_Email__c == null) || (l.Director_Email__c ==  ' '))
                   {
                     erstring += 'Director Last Name  \n';
                     hasError = true; 
                   } 
                      //if no products selected 
                   if(!((l.Direct_Debit_Requested__c) || (l.eCommerce__c) || (l.Video_Payment__c) || (l.Xero_Payment_Now__c) || (l.Xero_Direct_Debit__c) ))
                   {
                     erstring += 'One of the products Direct Debit Requested/Ecommerce/Video Payment/Xero Payment Now/Xero Direct Debit is not selected';
                     hasError = true; 
                   } 
                      //Finally add the error message if any of the fields above atre blank
                   if(hasError)
                   {
                     l.addError( erstring,false);
                   }
                  }
             }  
         }
}

Attached the popup screenshot. Does any one have any idea what is wrong?
User-added image
Hi,

We have a visualforce page in our salesforce org whose contoller class makes an API call and then display the result back on the page. This was placed on a record Detail page section in classic experince. It was working as expected. And we recently switched on Lightning Experience. The problem now is the visualforce page is working fine when the user clicks on command button in the page. It is getting the expected results. But it is gving an error when the user tries to update fields on the other sections after doing the API call(clicking the command button in the visualforce page).
This is the error:

This record was modified by USER during your edit session. Make a note of the data you entered, then reload the record and enter your updates again.

I am not sure what is causing this error.

Has anyone faced this issue?
It would be great if anyone can help.
Thanks,
Yamini.

 
Hi guys,

Can anyone please provide me an example on how to call a apex controller method in a visualforce custom component using a command button?
Hi Guys,

we are planning to move to lightning next month. We do have a couple of javascript buttons on the classic version at the moment. I am looking for an alternative to a javascript button for lead conversion. That button checks for some mandatory fields on leads before converting a lead and displays an alert window to fill the mandatory fields.

Would you guys please help me with a lightning alternative for this?