• shailendra singhai
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies
HI ,
Lightning related query; dropdown onchange;
I have custom object which is related to account. 
while keeping on component keeping as below
Featurename      Current status          Expected change dropdown
 ABC                    Active                Avalable option--> rectivate/inactive
XYZ                     inactive                   disable/Active

the vlues i am passing to component through handler class with wrapper
as below 

Feature name string/ Current status string/ expected change List<available option>

but while i select the dropdown value from the component , i am not getting that value in any attribute; and requirment is while select the dropdown it need to create string  and bind with feature name; 
note the feature name is around 15;
trying to use below code at component; 
<aura:iteration items="{!v.featureList}" var="featureObj">
                                        <tr>
                                            <td data-label="Features" >
                                            <div class="slds-truncate">{!featureObj.Feature}</div>
                                            </td>
                                            <td data-label="Status" >
                                            <div class="slds-truncate">{!featureObj.Status}</div>
                                            </td>
                                            <td data-label="Action" >
                                               <lightning:select class="dynamic" aura:id="ActionSelectDynamic"  >
                                                   <option value="">-- Select -- </option>
                                                    <aura:iteration items="{!featureObj.Action}" var="action">
                                                        <option value="{!action}" label="{!action}" title="{!action}" />
                                                        
                                                      </aura:iteration>
                                                </lightning:select>
 


 
if in soql with apex class 10 fields we have with select. and using with sharing. will it fetch the data for the user who is not having  who is  restricted with field level security for the field
i want to send Sobject to VF page, by clicking upon button present upon lightning component. getting issue that like @auraenabled class can't have the page reference
Could you please share any idea here,
I want to send Sobject to VF page, by clicking upon button present upon lightning component. getting issue that like  @auraenabled class can't have the page reference;

Actual requirment is.
A lightning tab 'ABC' hvaing component which contain some record onclick upon tab (through integration we picked the data) , that responsewe kept into object. i need on the same component a new button to create , and onclick this object dta move to VF page and VF page should be in PDF with functionality of email feature. 
hi,

Could you please help me to make the code bulkify, currently it is hitting governor limit for fetching more then 50001 row.
Issue/ Description:
i have on custom object ABC__c  which contain  20000 record's (having detail of name and phone number)
while creating lead i need to check if the lead(first name/ last name or phone number) present in the ABC__c object, one check box present__c on lead should get 'TRUE' and one comment field should update with matching criteria in lead itself.
i follow the below steps.
1. i have created trigger upon lead before insert, call the class by passing the lead in trigger.new
2. SOQL query to fetch data from ABC__C, create two set  one for phone and one for name
3. itrating the trigger.new record(lead record)
4. if match found keeping the check box true and comment field with comment.

it is working perfactly fine when we enterrecord manually.
but when use dataloader it break with governor limit.
could any one suggest in which step i am missing.

when we run with batch size two in dataloader it works but it takes two much time.
can you suggest for batch of 200 in dataloader ABC__C 20K record should call only once...

Thanks in advance



 
could you please help me to create test class for the below code, as mock test response need to create here, and iam new for this.
here the intraction between web application and salesforce is happning,
getting input from web application to update the record having valid recordID. 
@RestResource(urlMapping='/LeadRestUpdate/*')

Global with sharing class  NS_WS_Lead_update {
    @HttpPost
    Global static String doUpdate()
    {
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        System.debug('Params: ' + req.params);
        //String temp = req.requestBody.toString();
        String leadid = req.params.get('lead_id');
        Lead ll = [SELECT Id, FirstName,LastName, Phone, email, company FROM Lead WHERE Id = :leadid];
        if (req.params.get('step') == 'step1' || req.params.get('step') == 'step2' )
        {
            ll.FirstName = req.params.get('first_name');
            ll.LastName = req.params.get('last_name');
            ll.phone = req.params.get('phone');
            ll.Email = req.params.get('email');
            ll.Company = req.params.get('company_name');
            ll.Company_Registration_Number__c = req.params.get('registration_number');
            ll.Company_Status__c = req.params.get('company_status');
            ll.CompanyType__c = req.params.get('company_type');
            if(req.params.get('incorporated_date') != null && req.params.get('incorporated_date') != '' ) {
                ll.Incorporation_Date__c = Date.valueOf(req.params.get('incorporated_date'));
            }
            ll.Street = req.params.get('street');
            ll.City = req.params.get('city');
            ll.State = req.params.get('state');
            ll.Country = req.params.get('country');
            ll.PostalCode = req.params.get('zip');
            
        }
        if (req.params.get('step') == 'step2')
        {
            ll.Industry = req.params.get('industry');
            if(req.params.get('take_card_payment') == 'true')
               {
                ll.Do_you_take_Card_transactions__c = Boolean.valueOf( req.params.get('take_card_payment'));
                ll.Average_monthly_card_takings__c = req.params.get('cardtakings_amount');
                ll.Average_monthly_takings_4_200__c = Boolean.valueOf( req.params.get('cardtakings'));
                ll.Average_monthly_transactions_10__c = Boolean.valueOf( req.params.get('cardtransaction10andmore'));
            }
        }
        if (req.params.get('step') == 'step3')
        {
            Double amount_requested =  Double.valueOf(req.params.get('amount_requested'));
            ll.Amount_Requested__c = amount_requested;
            ll.Term_Requested__c  = Double.valueOf(req.params.get ('loan_term'));
            ll.Purpose_of_Facility__c = req.params.get('puropose_of_funding');
        }
        if (req.params.get('step') == 'step4')     
        {
            //ll.Web_to_Lead__c = Boolean.valueOf(req.params.get('web_to_lead'));
            ll.Residential_Address_City__c = req.params.get('residential_city');
            ll.Residential_Address_Country__c = req.params.get('residential_country');
            ll.Residential_Address_State_Province__c = req.params.get('residential_state');
            ll.Residential_Address_Street__c = req.params.get('residential_street');
            ll.Residential_Address_Zip_Postal_Code__c = req.params.get ('residential_zip');
            if (req.params.get('product_interested') != 'bca') {
                ll.Home_Owner__c = Boolean.valueOf(req.params.get('own_a_property'));
                ll.Ownership_is_of_Residential_Address__c = Boolean.valueOf(req.params.get('same_as_residency'));
                ll.Property_Address_City__c = req.params.get('property_city');
                ll.Property_Address_Country__c = req.params.get('property_country');
                ll.Property_Address_State_Province__c = req.params.get('property_state');
                ll.Property_Address_Street__c = req.params.get('property_street');
                ll.Property_Address_Zip_Postal_Code__c = req.params.get('property_zip');
            }
            if (req.params.get('allow_credit_search') == 'true')
                ll.Allow_searches_on_all_directors__c = Boolean.valueOf( req.params.get('allow_credit_search'));  
            else
                ll.Allow_searches_on_all_directors__c = false;
            if(req.params.get('allow_engaging_card_provider')!=null)
               {
                ll.Authorization_to_contact_card_provider__c = Boolean.valueOf( req.params.get('allow_engaging_card_provider'));
            }
            if(req.params.get('take_card_payment') == 'true')
               {
                ll.Do_you_take_Card_transactions__c = Boolean.valueOf( req.params.get('take_card_payment'));
                ll.Average_monthly_card_takings__c = req.params.get('cardtakings_amount');
                ll.Average_monthly_takings_4_200__c = Boolean.valueOf( req.params.get('cardtakings'));
                ll.Average_monthly_transactions_10__c = Boolean.valueOf( req.params.get('cardtransaction10andmore'));
            }
        }
        update ll;
        string messagesent='Thank You. Salesforce has Successfully Updated'+ll.id+req.params.get('step');
        return messagesent;
    }
}
Could anyonehelp me to create test class for below, iamnot getting the expected test coverage.

@RestResource(urlMapping='/LeadRestGet/*')

global with sharing class NS_WS_Lead_Insert {
    @HttpGet
    global static Lead doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //String leadId = req.params.get('existing_lead_id');
        String leadId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        Lead result = [SELECT Id, FirstName, LastName, phone, Email, Company,  Lead_Source_Information__c,
         Authorization_to_contact_card_provider__c          
        FROM Lead WHERE Id = :leadId];
        return result;
        
    }
    
    @HttpPost
    global static String doPost()
    {
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        System.debug('Params: ' + req.params);
        //String temp = req.requestBody.toString();
        Lead ll = new Lead();
        ll.FirstName = req.params.get('first_name');
        ll.LastName = req.params.get('last_name');
        ll.phone = req.params.get('phone');
        ll.Email = req.params.get('email');
        ll.Web_to_Lead__c = Boolean.valueOf(req.params.get('web_to_lead'));
        //if (req.params.get('web_to_lead') == 'true'){
        //    ll.Web_to_Lead__c = true;
        // }
               
        string messagesent;     
         try {
            insert ll;
        }
        catch (DMLException e)
        {
            messagesent=e.getMessage();
        }
        if(messagesent==null)  
        {
            messagesent=ll.id;
        }
        return messagesent;
    }
}
Task is Here corresponding to few values like name and DOB , while click upon search (upon visual force page) it will send content upon experion . and give us the detail of the person received from experion. and update that info to salesforce.

can you suggest is it possible to do this webservices
or we have to go for integration tools like jitterbit/talend  .
or anyother way.
if you have done this integration, please confirm this. it would be great help.

thanks in advance
I am using lightning component. There is a component to send email with fields to, subject, body and send button, cancel button.
on send button it calls to apex method as below: 
@AuraEnabled 
    public static void sendMailMethod( String mMail ,String mSubject ,String mbody, String recId ){
        //Fetching user details for cc the user in mail
        User u = [SELECT Id, Name, Email, Phone, MobilePhone FROM User where id =: userInfo.getUserId()];
        //Attach pdf timesheet to the mail
        PageReference pdfPage = new PageReference('/apex/time_WeeklyPDF?id='+recId); 
        //Get VisualForce page data  
        Blob file1;
        if(Test.isRunningTest()) { 
            file1 = blob.valueOf('Unit.Test');
        } else {
            file1 = pdfPage.getContentAsPDF(); 
        }
        // convert VisualForce page to  PDF format
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();             
        // Create Attachment
        efa.setFileName('WeeklyTimesheetAsPDF.pdf');
        efa.setBody(file1);
        List<Messaging.SingleEmailMessage> mails =  new List<Messaging.SingleEmailMessage>();     
        // Step 1: Create a new Email
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        // Step 2: Set list of people who should get the email
        string[] toaddress = mMail.split(',');
        string[] ccAddresses = new String[]{u.Email};
            mail.setToAddresses(toaddress);
        // Step 3: Set who the email is sent from
        mail.setReplyTo('noreply@gmail.com'); // change it with your mail address.
        mail.setSenderDisplayName('salesforce User'); 
        // Step 4. Set email contents - you can use variables!
        mail.setSubject(mSubject);
        mail.setHtmlBody(mbody);
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        mail.setCcAddresses(ccAddresses);
        // Step 5. Add your email to the master list
        mails.add(mail);
        // Step 6: Send all emails in the master list
        Messaging.sendEmail(mails);
    }
It was working previously but today when i clicked on send button its giving error as "FATAL_ERROR|Internal Salesforce.com Error" in debug log and nothing happens.
Need help on workaround for this, Why this error comes??
  • July 26, 2018
  • Like
  • 0
could you please help me to create test class for the below code, as mock test response need to create here, and iam new for this.
here the intraction between web application and salesforce is happning,
getting input from web application to update the record having valid recordID. 
@RestResource(urlMapping='/LeadRestUpdate/*')

Global with sharing class  NS_WS_Lead_update {
    @HttpPost
    Global static String doUpdate()
    {
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        System.debug('Params: ' + req.params);
        //String temp = req.requestBody.toString();
        String leadid = req.params.get('lead_id');
        Lead ll = [SELECT Id, FirstName,LastName, Phone, email, company FROM Lead WHERE Id = :leadid];
        if (req.params.get('step') == 'step1' || req.params.get('step') == 'step2' )
        {
            ll.FirstName = req.params.get('first_name');
            ll.LastName = req.params.get('last_name');
            ll.phone = req.params.get('phone');
            ll.Email = req.params.get('email');
            ll.Company = req.params.get('company_name');
            ll.Company_Registration_Number__c = req.params.get('registration_number');
            ll.Company_Status__c = req.params.get('company_status');
            ll.CompanyType__c = req.params.get('company_type');
            if(req.params.get('incorporated_date') != null && req.params.get('incorporated_date') != '' ) {
                ll.Incorporation_Date__c = Date.valueOf(req.params.get('incorporated_date'));
            }
            ll.Street = req.params.get('street');
            ll.City = req.params.get('city');
            ll.State = req.params.get('state');
            ll.Country = req.params.get('country');
            ll.PostalCode = req.params.get('zip');
            
        }
        if (req.params.get('step') == 'step2')
        {
            ll.Industry = req.params.get('industry');
            if(req.params.get('take_card_payment') == 'true')
               {
                ll.Do_you_take_Card_transactions__c = Boolean.valueOf( req.params.get('take_card_payment'));
                ll.Average_monthly_card_takings__c = req.params.get('cardtakings_amount');
                ll.Average_monthly_takings_4_200__c = Boolean.valueOf( req.params.get('cardtakings'));
                ll.Average_monthly_transactions_10__c = Boolean.valueOf( req.params.get('cardtransaction10andmore'));
            }
        }
        if (req.params.get('step') == 'step3')
        {
            Double amount_requested =  Double.valueOf(req.params.get('amount_requested'));
            ll.Amount_Requested__c = amount_requested;
            ll.Term_Requested__c  = Double.valueOf(req.params.get ('loan_term'));
            ll.Purpose_of_Facility__c = req.params.get('puropose_of_funding');
        }
        if (req.params.get('step') == 'step4')     
        {
            //ll.Web_to_Lead__c = Boolean.valueOf(req.params.get('web_to_lead'));
            ll.Residential_Address_City__c = req.params.get('residential_city');
            ll.Residential_Address_Country__c = req.params.get('residential_country');
            ll.Residential_Address_State_Province__c = req.params.get('residential_state');
            ll.Residential_Address_Street__c = req.params.get('residential_street');
            ll.Residential_Address_Zip_Postal_Code__c = req.params.get ('residential_zip');
            if (req.params.get('product_interested') != 'bca') {
                ll.Home_Owner__c = Boolean.valueOf(req.params.get('own_a_property'));
                ll.Ownership_is_of_Residential_Address__c = Boolean.valueOf(req.params.get('same_as_residency'));
                ll.Property_Address_City__c = req.params.get('property_city');
                ll.Property_Address_Country__c = req.params.get('property_country');
                ll.Property_Address_State_Province__c = req.params.get('property_state');
                ll.Property_Address_Street__c = req.params.get('property_street');
                ll.Property_Address_Zip_Postal_Code__c = req.params.get('property_zip');
            }
            if (req.params.get('allow_credit_search') == 'true')
                ll.Allow_searches_on_all_directors__c = Boolean.valueOf( req.params.get('allow_credit_search'));  
            else
                ll.Allow_searches_on_all_directors__c = false;
            if(req.params.get('allow_engaging_card_provider')!=null)
               {
                ll.Authorization_to_contact_card_provider__c = Boolean.valueOf( req.params.get('allow_engaging_card_provider'));
            }
            if(req.params.get('take_card_payment') == 'true')
               {
                ll.Do_you_take_Card_transactions__c = Boolean.valueOf( req.params.get('take_card_payment'));
                ll.Average_monthly_card_takings__c = req.params.get('cardtakings_amount');
                ll.Average_monthly_takings_4_200__c = Boolean.valueOf( req.params.get('cardtakings'));
                ll.Average_monthly_transactions_10__c = Boolean.valueOf( req.params.get('cardtransaction10andmore'));
            }
        }
        update ll;
        string messagesent='Thank You. Salesforce has Successfully Updated'+ll.id+req.params.get('step');
        return messagesent;
    }
}
Could anyonehelp me to create test class for below, iamnot getting the expected test coverage.

@RestResource(urlMapping='/LeadRestGet/*')

global with sharing class NS_WS_Lead_Insert {
    @HttpGet
    global static Lead doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //String leadId = req.params.get('existing_lead_id');
        String leadId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        Lead result = [SELECT Id, FirstName, LastName, phone, Email, Company,  Lead_Source_Information__c,
         Authorization_to_contact_card_provider__c          
        FROM Lead WHERE Id = :leadId];
        return result;
        
    }
    
    @HttpPost
    global static String doPost()
    {
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        System.debug('Params: ' + req.params);
        //String temp = req.requestBody.toString();
        Lead ll = new Lead();
        ll.FirstName = req.params.get('first_name');
        ll.LastName = req.params.get('last_name');
        ll.phone = req.params.get('phone');
        ll.Email = req.params.get('email');
        ll.Web_to_Lead__c = Boolean.valueOf(req.params.get('web_to_lead'));
        //if (req.params.get('web_to_lead') == 'true'){
        //    ll.Web_to_Lead__c = true;
        // }
               
        string messagesent;     
         try {
            insert ll;
        }
        catch (DMLException e)
        {
            messagesent=e.getMessage();
        }
        if(messagesent==null)  
        {
            messagesent=ll.id;
        }
        return messagesent;
    }
}
Task is Here corresponding to few values like name and DOB , while click upon search (upon visual force page) it will send content upon experion . and give us the detail of the person received from experion. and update that info to salesforce.

can you suggest is it possible to do this webservices
or we have to go for integration tools like jitterbit/talend  .
or anyother way.
if you have done this integration, please confirm this. it would be great help.

thanks in advance
Here is the Question


Create an Apex class that implements the Schedulable interface to update Lead records with a specific LeadSource. Write unit tests that achieve 100% code coverage for the class. This is very similar to what you did for Batch Apex.
Create an Apex class called 'DailyLeadProcessor' that uses the Schedulable interface.
The execute method must find the first 200 Leads with a blank LeadSource field and update them with the LeadSource value of 'Dreamforce'.
Create an Apex test class called 'DailyLeadProcessorTest'.
In the test class, insert 200 Lead records, schedule the DailyLeadProcessor class to run and test that all Lead records were updated correctly.
The unit tests must cover all lines of code included in the DailyLeadProcessor class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.


Here is my code so far

global class DailyLeadProcessor implements Schedulable {

    global void execute(SchedulableContext ctx) {
        list<leads>Lead = [select leadSource from lead where isnull= true]
        
         for (Integer i = 0; i < 200; i++) {
            Leads.add(new lead(
                name='Dream force'+i
            ));
        }
        insert Leads;
    }

I am not sure what is wrong here
Hi all,

I'm stuck in the Apex Integration Services - Apex SOAP Callouts challenge with the following message "The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.".

Could you please advise ?
Hi,
       I have Two Strings Like
String s1='Tue Nov 18 00:00:00 GMT 2014';
String s2='Sun Nov 30 00:00:00 GMT 2014';

How To get s1 and s2 are like below
o/p:s1=11/18/2014
      s2=11/130/2014

help me...


 

Hi,

 

 am trying to send the mass email to contacts.I am getting the error as  below.Am doing this in a DE org.

 


System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.

 

 

My coding as  below

 

 private final List<Id> contactids;
  public List<Contact> con;
  public testemail(ApexPages.StandardController controller)
  {
     con = [select Id from Contact limit 5];    
     contactids=new  List<Id>();     
     for(Integer i=0;i<con.size();i++)
     {    
      contactids.add(con[i].Id);       
     } 
  }

  public void SendEmail()
  {
      Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
      mail.setTargetObjectIds(contactids);   
      mail.setTemplateId('00X90000000ZQgA');
      Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
  } 

 

 

  Can anybody tell me how to enable single email/mass email?

 

  Thanks  for any help

 

 

  • January 18, 2010
  • Like
  • 0