• Shruthi Narsi
  • NEWBIE
  • 67 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 108
    Questions
  • 83
    Replies
Hi 

I have to enable the audit field in my production for data migration leads accounts contacts and opportunities.

Can anyone help me with a way I have user permission set 
User-added image
 
Hi

I need to save the out from the developer console. I need the ids and names of accounts to migrate contacts related to the accounts. Can anyone help me with the same
Hi 

Can anyone help me with the below requirement?

I need to add a condition for updating the records when country value is equal to Singapore of Philippines or if the country value changes then the record should get updated 
Hi

Please help me with free app exchange products which you have tried and it's successfully working for Facebook lead adds integration with salesforce.
Hi

Please help me. I have installed a Salesforce Lead capture application from app exchange

I am getting below error. Can anyone help me with the sameUser-added image

Below are the configuration steps

file:///C:/Users/Prosera%20Analytics/Desktop/Lead_Capture_Users_Guide_v1.1_Editions.pdf

 
Hi 

I am unable to complete the superbadge

please find the below link

https://trailhead.salesforce.com/en/content/learn/superbadges/superbadge_business_specialist

I am not able to complete the 3rd step. Can anyone help me

Couldn't find a component with the title 'Top Accounts'.

User-added imageUser-added imageUser-added image
Hi I am not getting the option of view as dasboard user. I need  to make changes in settings so that the user who login in should be able to view the dashboard in his name. I am not able to get that option in PE edition. Can anyone help

User-added image
I have created an assignment rule but all leads are getting assigned to default owner.

I want it to get assigned to owner of lead. I have selected default check box as checked for assigned.

User-added image
But still its not getting assigned to the lead owner

User-added image
 
1)I have a requirement to intgrate whatsapp with salesforce. I able to send and rec messgae using aura componenet. But the replies cannot be stored in salesforce. Can this be done using batch class.Running the batch at the specific time .
2)Can we automate the process of sending messages from whatsapp to Salesforce by making auto reply or auto message ?
 
I have written a test class to add list of leads and display on account page the lead should be of record type Partner Lead Registration.The test class code coverage is 90% in sandbox. While deploying its showing code coverage is 0% can anyone rewrite the test class to deploy the code successfully in prod

Below is the code I have writtena and the test class code covergae is 90%. Can anyone make the changes in the code so that ot gets deployed in prod. Error says test class code covergae is 0

Apex class

public  class PartnerLeadController {
    public Account acc{get;set;}
    public List<Lead> LeadList{get;set;}  
    Set<String> UserContactId = new Set<String>(); 
    public PartnerLeadController(ApexPages.StandardController stdController) {
        LeadList = new List<Lead>();
        this.acc = (Account)stdController.getRecord();
        list<contact> conlist=[Select Id From Contact WHERE AccountId =:acc.Id]; 
        for(User u: [Select Id, Name, ContactId FROM USER WHERE isactive=TRUE AND ContactId In:conlist]){
            UserContactId.add(u.Id);
        }
        LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,MAU__c,Estimated_Opportunity_Deal__c,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }
}

Vf page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false"  >

    <apex:form >
       

        <apex:pageBlock rendered="true" >
            <apex:outputPanel layout="block" styleClass="container">
            <apex:pageBlockTable value="{!LeadList}" var="ld" width="100" >
               
                          
            <apex:column >
                <apex:outputLink value="/{!ld.Owner}" target="_top">{!ld.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            </apex:column>/> 
                
                 <apex:column ><apex:outputField value="{!ld.Name}" />
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column ><apex:outputField value="{!ld.Status}" />
                <apex:facet name="header">Status</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Company}" />
                <apex:facet name="header">Company</apex:facet>
            </apex:column> 
                 <apex:column ><apex:outputField value="{!ld.MAU__c}" />
                <apex:facet name="header">MAU</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Estimated_Opportunity_Deal__c}" />
                <apex:facet name="header">Estimated Opportunity Deal</apex:facet>
            </apex:column> 
                
            <apex:column ><apex:outputField value="{!ld.CreatedDate}" />
                <apex:facet name="header">CreatedDate</apex:facet>
         
            </apex:column> 
            </apex:pageBlockTable>
                </apex:outputPanel>
        </apex:pageBlock>  
      
    </apex:form>
</apex:page>

Test class

@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
     
        Test.setCurrentPage(pageRef);
        
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
          
        
            }
   
}





 
Below is the code I have written and the test class code covergae is 90%. Can anyone make the changes in the code so that ot gets deployed in prod. Error says test class code covergae is 0. I have written the code to add list of leads to be displayed on account. 

Apex class

public  class PartnerLeadController {
    public Account acc{get;set;}
    public List<Lead> LeadList{get;set;}  
    Set<String> UserContactId = new Set<String>(); 
    public PartnerLeadController(ApexPages.StandardController stdController) {
        LeadList = new List<Lead>();
        this.acc = (Account)stdController.getRecord();
        list<contact> conlist=[Select Id From Contact WHERE AccountId =:acc.Id]; 
        for(User u: [Select Id, Name, ContactId FROM USER WHERE isactive=TRUE AND ContactId In:conlist]){
            UserContactId.add(u.Id);
        }
        LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,MAU__c,Estimated_Opportunity_Deal__c,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }
}

Vf page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false"  >

    <apex:form >
       

        <apex:pageBlock rendered="true" >
            <apex:outputPanel layout="block" styleClass="container">
            <apex:pageBlockTable value="{!LeadList}" var="ld" width="100" >
               
                          
            <apex:column >
                <apex:outputLink value="/{!ld.Owner}" target="_top">{!ld.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            </apex:column>/> 
                
                 <apex:column ><apex:outputField value="{!ld.Name}" />
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column ><apex:outputField value="{!ld.Status}" />
                <apex:facet name="header">Status</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Company}" />
                <apex:facet name="header">Company</apex:facet>
            </apex:column> 
                 <apex:column ><apex:outputField value="{!ld.MAU__c}" />
                <apex:facet name="header">MAU</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Estimated_Opportunity_Deal__c}" />
                <apex:facet name="header">Estimated Opportunity Deal</apex:facet>
            </apex:column> 
                
            <apex:column ><apex:outputField value="{!ld.CreatedDate}" />
                <apex:facet name="header">CreatedDate</apex:facet>
         
            </apex:column> 
            </apex:pageBlockTable>
                </apex:outputPanel>
        </apex:pageBlock>  
      
    </apex:form>
</apex:page>

Test class

@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
     
        Test.setCurrentPage(pageRef);
        
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
          
        
            }
   
}
I have written the below test class to add list of partner leads with record type as Partner Lead registartion on account page. Can you help me with the code
@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
        Test.setCurrentPage(pageRef);
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
        partlead.getlead();
        partlead.initlead();
    }
   
}

Apex class

public  class PartnerLeadController {
    public Account acc{get;set;}
    public List<Lead> LeadList{get;set;}  
    Set<String> UserContactId = new Set<String>(); 
    public PartnerLeadController(ApexPages.StandardController stdController) {
        LeadList = new List<Lead>();
        this.acc = (Account)stdController.getRecord();
        list<contact> conlist=[Select Id From Contact WHERE AccountId =:acc.Id]; 
        for(User u: [Select Id, Name, ContactId FROM USER WHERE isactive=TRUE AND ContactId In:conlist]){
            UserContactId.add(u.Id);
        }
        LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,MAU__c,Estimated_Opportunity_Deal__c,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }
}

VF Page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false"  >

    <apex:form >
       

        <apex:pageBlock rendered="true" >
            <apex:outputPanel layout="block" styleClass="container">
            <apex:pageBlockTable value="{!LeadList}" var="ld" width="100" >
               
                          
            <apex:column >
                <apex:outputLink value="/{!ld.Owner}" target="_top">{!ld.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            </apex:column>/> 
                
                 <apex:column ><apex:outputField value="{!ld.Name}" />
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column ><apex:outputField value="{!ld.Status}" />
                <apex:facet name="header">Status</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Company}" />
                <apex:facet name="header">Company</apex:facet>
            </apex:column> 
                 <apex:column ><apex:outputField value="{!ld.MAU__c}" />
                <apex:facet name="header">MAU</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Estimated_Opportunity_Deal__c}" />
                <apex:facet name="header">Estimated Opportunity Deal</apex:facet>
            </apex:column> 
                
            <apex:column ><apex:outputField value="{!ld.CreatedDate}" />
                <apex:facet name="header">CreatedDate</apex:facet>
         
            </apex:column> 
            </apex:pageBlockTable>
                </apex:outputPanel>
        </apex:pageBlock>  
      
    </apex:form>
</apex:page>

User-added image
I have written a test class to add list of leads

@isTest
private class UpdateUnitPriceTest {

    static testMethod void myUnitTest() {

        Test.startTest();

       Account myaccount = new Account (name='Test');
        insert myaccount;
        
LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }

        // Verify the expressions are the same
        System.assertEquals('Lead list',+LeadList);

        

        Test.stopTest();

    }
}

Apex class
@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
        Test.setCurrentPage(pageRef);
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
        partlead.getlead();
        partlead.initlead();
    }
   
}
Can anyone help me with the test class to add parten lead list on account page

Below is my apex class

public class PartnerLeadController {
    public Account acc{get;set;}
    public List<Lead> LeadList{get;set;}  
    Set<String> UserContactId = new Set<String>(); 
    public PartnerLeadController(ApexPages.StandardController stdController) {
        LeadList = new List<Lead>();
        this.acc = (Account)stdController.getRecord();
        list<contact> conlist=[Select Id From Contact WHERE AccountId =:acc.Id]; 
        for(User u: [Select Id, Name, ContactId FROM USER WHERE isactive=TRUE AND ContactId In:conlist]){
            UserContactId.add(u.Id);
        }
        LeadList = [select id,Name, OwnerId, Owner.Name,LeadSource,CRM_User__r.Name,CRM_User__r.Id, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where  CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner'];
    }
}

Test class

@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
        Test.setCurrentPage(pageRef);
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
        partlead.getlead();
        partlead.initlead();
    }
   
}

Vf page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false" >
    <apex:form >
        <apex:pageBlock rendered="true">
            <apex:pageBlockTable value="{!LeadList}" var="ld">
                <apex:column >
                    {!ld.Name}
                    <apex:facet name="header">Lead Name</apex:facet>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>  
    </apex:form>
</apex:page>
I have written the below apex class to display the lead who are parter

For example if I select the partner lead which is a look up feild as xyz then on account page I shoud be able to see his details I am getting ebelow error

Apex class
public class PartnerLeadController {
    
   public final Account acc;
   
    public PartnerLeadController(ApexPages.StandardController stdController) {
        this.acc = (Account)stdController.getRecord();
        initlead();
    }
    List<Lead> lead;
    
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName,Name from Lead where Partner_Name__c = : acc.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    }
    
    public List<Lead> getlead () {
        return lead;
    }   
    
}
Vf Page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false" >
   
    <style>
        body {
       
        }
    </style>
    <apex:pageBlock rendered="true">
        <apex:pageBlockTable value="{!lead}" var="l">
            <apex:column >
                <apex:outputLink value="/Lead/{!l.Id}/view" target="_top">{!l.Name}</apex:outputLink>
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column >
                <apex:outputLink value="/lead/{!l.AccountId}/view" target="_top">{!l.Account.Name}</apex:outputLink>
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column >
                <apex:outputLink value="/{!l.OwnerId}" target="_top">{!l.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            </apex:column>/>
            <apex:column ><apex:outputField value="{!l.Name}" />
                <apex:facet name="header">Name</apex:facet>
            </apex:column>
            <apex:column ><apex:outputField value="{!l.Status}" />
                <apex:facet name="header">Status</apex:facet>
            </apex:column>

        </apex:pageBlockTable>
    </apex:pageBlock>      
</apex:page>

User-added image
 
I have written the eblow code to display partner leads. Can u fix the error for me and help  me in writing test class for the same

Apex class
public class PartnerLeadController {
    public class PartnerLeadsController {
    
    private final Lead l;
    
    public PartnerLeadsController(ApexPages.StandardController stdController) {
        this.l = (Lead)stdController.getRecord();
        initlead();
    }
    
    List<Lead> lead;
    
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName from Lead where Partner_Name__c = :l.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    }
    
    public List<Lead> getlead () {
        return lead;
    }   
    
}

           

}

Vf page

public class PartnerLeadController {
    public class PartnerLeadsController {
    
    private final Lead l;
    
    public PartnerLeadsController(ApexPages.StandardController stdController) {
        this.l = (Lead)stdController.getRecord();
        initlead();
    }
    
    List<Lead> lead;
    
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName from Lead where Partner_Name__c = :l.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    }
    
    public List<Lead> getlead () {
        return lead;
    }   
    
}

           

}

User-added image
I need to post to chatter if the opportunity and lead has 3 tasks pending.Can anyone modiy the below code accordingly

public class MyBellNotification { public static void notifyCurrentUser(String message) { Http h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint(Url.getOrgDomainUrl().toExternalForm() + '/services/data/v46.0/actions/standard/customNotificationAction'); req.setMethod('POST'); req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()); req.setHeader('Content-Type', 'application/json'); CustomNotificationActionInput input = new CustomNotificationActionInput(); input.customNotifTypeId = '0ML0b000000KyjGGAS'; input.recipientIds = new List<String>{UserInfo.getUserId()}; input.title = 'Test Data Operation Completed'; input.body = message; input.targetId = '0ML0b000000KyjGGAS'; CustomNotificationAction action = new CustomNotificationAction(); action.inputs = new List<CustomNotificationActionInput>{input}; req.setBody(JSON.serialize(action)); HttpResponse res = h.send(req); System.debug(res.getBody()); } public class CustomNotificationAction { public List<CustomNotificationActionInput> inputs { get; set; } } public class CustomNotificationActionInput { public String customNotifTypeId { get; set; } public List<String> recipientIds { get; set; } public String title { get; set; } public String body { get; set; } public String targetId { get; set; } } }
I have written a test class to create PDF on quote. Can anyone help me with the test class and make the code covergae as 90% atleast. Since the logic of ny test class is wrong

Apex class
public class QuotePDF {
    public boolean show{get;set;}
    public id pdtId{get;set;}
    public Quote op{get;set;}
    public QuoteLineItem oli{get;set;}
    public string pb{get;set;}
    public Id opid{get;set;}
    public id prodid{get;set;}
    public list<QuoteLineItem> OliList{get;set;}
    public list<Quotelineitem> OliCreate;
    public integer deleteIndex{get;set;}
    
    public QuotePDF()
    {
        show=false;
        oli=new QuoteLineItem();
        op=new Quote();
        OliList=new list<QuoteLineItem>();
        OliCreate=new list<Quotelineitem>();
    }
    
    public void save(){
        pricebook2 spbid=[select id from pricebook2 where isStandard=true limit 1];
        
        opportunity o1=[select id from opportunity limit 1];
        op.OpportunityId=o1.id;
        op.Pricebook2Id=spbid.id;
        upsert op;
        map<id,id>pdtTopbemap=new map<id,id>();
        
        for(pricebookentry pb:[select product2id,id from pricebookentry where pricebook2id =:spbid.id ])
        {
            pdtTopbemap.put(pb.product2id,pb.id);
        }
        for(QuoteLineItem o:OliList)
        {
            o.QuoteId=op.id;
            o.unitprice=o.unitprice; 
            o.quantity=o.quantity;
            o.pricebookentryid=pdtTopbemap.get(o.product2id);
            o.Product2Id=o.product2id;
            OliCreate.add(o);
        }
        insert OliCreate;
    }
    public void AddOli()
    {
        show=true;
        QuoteLineItem olitemp = new QuoteLineItem();
        OliList.add(olitemp);
    }
    
    public void deleteOpp()
    {
        OliList.remove(deleteIndex);
    }
}

VF

<apex:page standardController="Quotes__c" renderAs="{!renderAs}" extensions="QuoteApexClass" sidebar="false">
    <apex:form id="form1" rendered="{!showPrintLink}" style="width:700px; margin:auto; float:center;font-family:Times New Roman;font-size: 18px;"> 
        <Right>
            <apex:commandButton action="{!print}" value="Save to PDF" style="float:center;color: #0A3FF3; font-size: 17px;right:0px;position:relative;border-radius:1px;"/>
            <apex:commandButton action="{!saveQuoteAsPDFandEmail}" value="Save and Email" style="float:center;color: #0A3FF3; font-size: 17px;right:-20px;position:relative; border-radius:1px;"/>
            <apex:commandButton action="{!cancel}" value="Cancel" style="float:center;color: #0A3FF3; font-size: 17px;right:-40px;position:relative; border-radius:1px;"/>
        </Right>
        <br/><br/><br/>
        <apex:outputPanel rendered="{!If(selectedList=='Standard' , true, false)}">
            <html>
                <head>
                    <div style="background-color: #ffe4c4;margin-top: -32px;">
                        <apex:image url="{!URLFOR($Resource.Proseralogo)}" width="200" height="60" alt="plogo"/><br/><br/>
                        <b style="font-size: 20px;">{!$Organization.Name}</b>
                    </div>
                </head>
                <body>
                    <br/> 
                    <table width="100%"> 
                        <tr><td style="background-color:#add8e6;" colspan="6">General Information</td></tr>
                        <tr>
                            <td width="66%">Company Address: {!$Organization.Country}</td>
                            <td></td>
                            <td>Quote Number:{!Quotes__c.Quote_Number__c}</td>
                        </tr>
                        <tr>
                            <td></td>
                            <td></td>
                            <td>Expiration Date:<apex:outputField value="{!Quotes__c.Expiration_Date__c}"/></td>
                        </tr>
                    </table><br/>
                    <div style="background-color:#add8e6;">Contact Information </div>
                    <table>
                        <tr>
                            <td>Prepared By:</td>
                        </tr>
                        <tr>
                            <td>Email:{!Quotes__c.Email__c}</td>
                        </tr>
                    </table><br/>
                    <div style="background-color:#add8e6;">Address Information</div>
                    <table>
                        <tr>
                            <td>
                                Bil To:<p style="margin-left: 49px;margin-top: -20px;margin-right: 311px;font-size: 15px;">
                                {!Quotes__c.Bill_To__c}
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td style="font-size: 15px;">Ship To:{!Quotes__c.Quote_Number__c}</td>
                        </tr>
                    </table><br/>
                    <div style="background-color:#add8e6;">Product Details</div>
                    <table style=" width:100%;">
                        <tr border="1" style="background-color: #deb887;"> 
                            <th style="text-align:center">Product Name</th>
                            <th style="text-align:center">List Price</th>
                            <th style="text-align:center">Sales Price</th>
                            <th style="text-align:center">Quantity</th>
                            <th style="text-align:center">Total Price</th>  
                        </tr>
                        <apex:repeat value="{!Quotes__c.Quote_Line_Items__r}" var="QuoteLine">
                            <tr style="border: 1px solid #ddd; background-color: #f2f2f2;background-color: #ddd;">
                                <td style="text-align:center">{!QuoteLine.Product2Id__r.Name}</td>
                                <td style="text-align:center">{!QuoteLine.ListPrice__c}</td>
                                <td style="text-align:center">{!QuoteLine.UnitPrice__c}</td>
                                <td style="text-align:center">{!QuoteLine.Quantity__c}</td>
                                <td style="text-align:center">{!QuoteLine.Total_Price__c}</td>
                            </tr>
                        </apex:repeat>
                    </table><br/>
                    <div style="background-color:#add8e6;">Totals</div>
                    <table>
                        <tr>
                            <td>Sub Total:₹<apex:outputLabel escape="false" value="{!Quotes__c.SubTotal__c}"/></td>
                        </tr>
                        <tr>
                            <td>Discount:₹<apex:outputLabel escape="false" value="{!Quotes__c.Discount__c}"/></td>
                        </tr>
                        <tr>
                            <td>Total Price:₹<apex:outputLabel escape="false" value="{!Quotes__c.Total_Price__c}"/></td>
                        </tr>
                        <tr>
                            <td>Tax:₹<apex:outputLabel escape="false" value="{!Quotes__c.Tax__c}"/></td>
                        </tr>
                        <tr>
                            <td>Shipping and Handling:₹<apex:outputLabel escape="false" value="{!Quotes__c.ShippingHandling__c}"/></td>
                        </tr>
                        <tr>
                            <td>Grand Total:₹<apex:outputLabel escape="false" value="{!Quotes__c.Grand_Total__c}"/></td>
                        </tr>
                    </table><br/>
                    <div style="background-color:#add8e6;margin-bottom: 6px;">Quote Acceptance Information</div>
                    <table>
                        <tr>
                            <td style="margin-bottom: 6px;">Signature:........................</td>
                        </tr>
                        <tr>
                            <td style="margin-bottom: 6px;">Name:..............................</td>
                        </tr>
                        <tr>
                            <td style="margin-bottom: 6px;">Title:..............................</td>
                        </tr>
                        <tr>
                            <td style="margin-bottom: 6px;">Date:...............................</td>
                        </tr>
                    </table>
                </body>
            </html>

Test Class

@isTest
Public class QuoteApexClassTest {
    @isTest public static void QuoteApextestMethod() {
 Opportunities__c opp = new Opportunities__c();
        opp.Name = 'TestOpp';
        opp.Close_Date__c = System.today() + 5;
        opp.Stage__c = 'Prospecting';
        Insert opp;
        
        Quotes__c q = new Quotes__c();
        q.Name = 'test';
        q.OpportunityId__c = opp.Id;
        Insert q;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(q);
        PageReference pageRef = Page.QuoteTemplate;
        pageRef.getParameters().put('id', String.valueOf(q.Id));
        Test.setCurrentPage(pageRef);

    
    PageReference pref = Page.QuoteTemplate;
      
    pref.getParameters().put('id',opp.id);
    Test.setCurrentPage(pref);

   


  }
}
I have written a test class to create PDF but logic is not working can anyone help me with the test class

Apex Class

public class QuotePDF {
    public boolean show{get;set;}
    public id pdtId{get;set;}
    public Quote op{get;set;}
    public QuoteLineItem oli{get;set;}
    public string pb{get;set;}
    public Id opid{get;set;}
    public id prodid{get;set;}
    public list<QuoteLineItem> OliList{get;set;}
    public list<Quotelineitem> OliCreate;
    public integer deleteIndex{get;set;}
    
    public QuotePDF()
    {
        show=false;
        oli=new QuoteLineItem();
        op=new Quote();
        OliList=new list<QuoteLineItem>();
        OliCreate=new list<Quotelineitem>();
    }
    
    public void save(){
        pricebook2 spbid=[select id from pricebook2 where isStandard=true limit 1];
        
        opportunity o1=[select id from opportunity limit 1];
        op.OpportunityId=o1.id;
        op.Pricebook2Id=spbid.id;
        upsert op;
        map<id,id>pdtTopbemap=new map<id,id>();
        
        for(pricebookentry pb:[select product2id,id from pricebookentry where pricebook2id =:spbid.id ])
        {
            pdtTopbemap.put(pb.product2id,pb.id);
        }
        for(QuoteLineItem o:OliList)
        {
            o.QuoteId=op.id;
            o.unitprice=o.unitprice; 
            o.quantity=o.quantity;
            o.pricebookentryid=pdtTopbemap.get(o.product2id);
            o.Product2Id=o.product2id;
            OliCreate.add(o);
        }
        insert OliCreate;
    }
    public void AddOli()
    {
        show=true;
        QuoteLineItem olitemp = new QuoteLineItem();
        OliList.add(olitemp);
    }
    
    public void deleteOpp()
    {
        OliList.remove(deleteIndex);
    }
}

Test Class

@isTest
Public class QuoteApexClassTest {
    @isTest public static void QuoteApextestMethod() {
        Opportunities__c opp = new Opportunities__c();
        opp.Name = 'TestOpp';
        opp.Close_Date__c = System.today() + 5;
        opp.Stage__c = 'Prospecting';
        Insert opp;
        
        Quotes__c q = new Quotes__c();
        q.Name = 'test';
        q.OpportunityId__c = opp.Id;
        Insert q;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(q);
        PageReference pageRef = Page.QuoteTemplate;
        pageRef.getParameters().put('id', String.valueOf(q.Id));
        Test.setCurrentPage(pageRef);
        
        QuoteApexClass qac = new QuoteApexClass(sc);        
        qac.saveQuoteAsPDFandEmail();
         
        qac.print();
    } 
}
Can Anyone help me with the test class and make the code coverage to 100%

Apex class

public class QuotePDF {
    public boolean show{get;set;}
    public id pdtId{get;set;}
    public Quote op{get;set;}
    public QuoteLineItem oli{get;set;}
    public string pb{get;set;}
    public Id opid{get;set;}
    public id prodid{get;set;}
    public list<QuoteLineItem> OliList{get;set;}
    public list<Quotelineitem> OliCreate;
    public integer deleteIndex{get;set;}
    
    public QuotePDF()
    {
        show=false;
        oli=new QuoteLineItem();
        op=new Quote();
        OliList=new list<QuoteLineItem>();
        OliCreate=new list<Quotelineitem>();
    }
    
    public void save(){
        pricebook2 spbid=[select id from pricebook2 where isStandard=true limit 1];
        
        opportunity o1=[select id from opportunity limit 1];
        op.OpportunityId=o1.id;
        op.Pricebook2Id=spbid.id;
        upsert op;
        map<id,id>pdtTopbemap=new map<id,id>();
        
        for(pricebookentry pb:[select product2id,id from pricebookentry where pricebook2id =:spbid.id ])
        {
            pdtTopbemap.put(pb.product2id,pb.id);
        }
        for(QuoteLineItem o:OliList)
        {
            o.QuoteId=op.id;
            o.unitprice=o.unitprice; 
            o.quantity=o.quantity;
            o.pricebookentryid=pdtTopbemap.get(o.product2id);
            o.Product2Id=o.product2id;
            OliCreate.add(o);
        }
        insert OliCreate;
    }
    public void AddOli()
    {
        show=true;
        QuoteLineItem olitemp = new QuoteLineItem();
        OliList.add(olitemp);
    }
    
    public void deleteOpp()
    {
        OliList.remove(deleteIndex);
    }
}

Test Class

@isTest
Public class QuoteApexClassTest {
    @isTest public static void QuoteApextestMethod() {
        Opportunity opp = new Opportunity();
        opp.Name = 'TestOpp';
        opp.CloseDate = System.today() + 5;
        opp.StageName = 'Prospecting';
        Insert opp;
        
        Quote q = new Quote();
        q.Name = 'test';
        q.OpportunityId = opp.Id;
        Insert q;
        

       ApexPages.StandardController sc = new ApexPages.StandardController(q);
        PageReference pageRef = Page.QuoteTemplate;
        pageRef.getParameters().put('id', String.valueOf(q.Id));
        Test.setCurrentPage(pageRef);
    
        QuoteApexClass qac = new QuoteApexClass(sc);        
        qac.saveQuoteAsPDFandEmail();
        qac.attachPDF();
        qac.getShowPrintLink();
        qac.print();
    }
}

User-added image
Add all amount on opportunity on quota actual amount 

User-added image
public with sharing class listopponquota {
    
    public list<Opportunity> oppList{get;set;}
    
    public listopponquota()
    {
        String selectedVal ='';
        oppList = new list<Opportunity>();
        oppList();
    }
    
    public pageReference oppList() {
        Id qId = (Id) ApexPages.currentPage().getParameters().get('id');
        system.debug('Id-->'+qId);    
        List<quota__c> quotaList1 = new List<quota__c>();
        List<Opportunity> oppList1 = new List<Opportunity>();
        quotaList1 =[select Id, Name,Start_Date__c,End_Date__c,Assign_to_User__c,Actual_Amount__c,OwnerId from quota__c where Id   =: qId Limit 1];
        oppList1 = [Select Id, Name, CloseDate, StageName,Amount,OwnerId From Opportunity where StageName = 'Closed Won'];
        
        system.debug('quotaList1-->'+quotaList1);
        if(quotaList1.size() > 0){
            for(quota__c q : quotaList1){
                system.debug('Name-->'+q.Name);
                for(Opportunity opp : oppList1){
                    system.debug('closedDate-->'+opp.CloseDate);
                    if(opp.CloseDate  >=  q.Start_Date__c  && opp.CloseDate <= q.End_Date__c && q.Assign_to_User__c == q.OwnerId && q.RecordTypeId == '0122v000002KFRAAA4'){
                        oppList.add(opp);
                    } 
                    if( q.RecordTypeId == '0122v000002KFRAAA4') {
                    q.Actual_Amount__c = 0;
                } else {
                    q.Actual_Amount__c = q.Actual_Amount__c + Decimal.ValueOf(String.ValueOf(q.get('Actual_Amount__c')));                    
                    quotaList1.add(q);
                }
            }
        }
        if(quotaList1.size()>0) {            
            update quotaList1;
             
        
        }
    }
        system.debug('oppList-->'+oppList);
            return null;
}
}
    
Hi 

I have to enable the audit field in my production for data migration leads accounts contacts and opportunities.

Can anyone help me with a way I have user permission set 
User-added image
 
Hi 

I am unable to complete the superbadge

please find the below link

https://trailhead.salesforce.com/en/content/learn/superbadges/superbadge_business_specialist

I am not able to complete the 3rd step. Can anyone help me

Couldn't find a component with the title 'Top Accounts'.

User-added imageUser-added imageUser-added image
I have created an assignment rule but all leads are getting assigned to default owner.

I want it to get assigned to owner of lead. I have selected default check box as checked for assigned.

User-added image
But still its not getting assigned to the lead owner

User-added image
 
1)I have a requirement to intgrate whatsapp with salesforce. I able to send and rec messgae using aura componenet. But the replies cannot be stored in salesforce. Can this be done using batch class.Running the batch at the specific time .
2)Can we automate the process of sending messages from whatsapp to Salesforce by making auto reply or auto message ?
 
I have written the below test class to add list of partner leads with record type as Partner Lead registartion on account page. Can you help me with the code
@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
        Test.setCurrentPage(pageRef);
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
        partlead.getlead();
        partlead.initlead();
    }
   
}

Apex class

public  class PartnerLeadController {
    public Account acc{get;set;}
    public List<Lead> LeadList{get;set;}  
    Set<String> UserContactId = new Set<String>(); 
    public PartnerLeadController(ApexPages.StandardController stdController) {
        LeadList = new List<Lead>();
        this.acc = (Account)stdController.getRecord();
        list<contact> conlist=[Select Id From Contact WHERE AccountId =:acc.Id]; 
        for(User u: [Select Id, Name, ContactId FROM USER WHERE isactive=TRUE AND ContactId In:conlist]){
            UserContactId.add(u.Id);
        }
        LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,MAU__c,Estimated_Opportunity_Deal__c,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }
}

VF Page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false"  >

    <apex:form >
       

        <apex:pageBlock rendered="true" >
            <apex:outputPanel layout="block" styleClass="container">
            <apex:pageBlockTable value="{!LeadList}" var="ld" width="100" >
               
                          
            <apex:column >
                <apex:outputLink value="/{!ld.Owner}" target="_top">{!ld.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            </apex:column>/> 
                
                 <apex:column ><apex:outputField value="{!ld.Name}" />
                <apex:facet name="header">Lead Name</apex:facet>
            </apex:column>
            <apex:column ><apex:outputField value="{!ld.Status}" />
                <apex:facet name="header">Status</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Company}" />
                <apex:facet name="header">Company</apex:facet>
            </apex:column> 
                 <apex:column ><apex:outputField value="{!ld.MAU__c}" />
                <apex:facet name="header">MAU</apex:facet>
            </apex:column> 
                <apex:column ><apex:outputField value="{!ld.Estimated_Opportunity_Deal__c}" />
                <apex:facet name="header">Estimated Opportunity Deal</apex:facet>
            </apex:column> 
                
            <apex:column ><apex:outputField value="{!ld.CreatedDate}" />
                <apex:facet name="header">CreatedDate</apex:facet>
         
            </apex:column> 
            </apex:pageBlockTable>
                </apex:outputPanel>
        </apex:pageBlock>  
      
    </apex:form>
</apex:page>

User-added image
I have written a test class to add list of leads

@isTest
private class UpdateUnitPriceTest {

    static testMethod void myUnitTest() {

        Test.startTest();

       Account myaccount = new Account (name='Test');
        insert myaccount;
        
LeadList = [select id,Name,CreatedDate,Company,OwnerId,Owner.Name,LeadSource,recordType.Name,CRM_User__r.Name,CRM_User__r.Id,CRM_User__c, Status, Account__c,LastName, Account__r.id,Account__r.OwnerId
                    from Lead 
                    where    CRM_User__c !=null And Account__c=: acc.Id AND LeadSource='Partner' AND recordType.Name = 'Partner Lead Registration' ];
    }

        // Verify the expressions are the same
        System.assertEquals('Lead list',+LeadList);

        

        Test.stopTest();

    }
}

Apex class
@isTest
public class PartnerLeadControllerTestClass {
    
    static testMethod void leadscontroller()
    {        
        Account myaccount = new Account (name='Test');
        insert myaccount;
        
        PageReference pageRef = Page.PartnerleadList;
        pageRef.getparameters().put('recordId', myaccount.Id);  
        Test.setCurrentPage(pageRef);
        
        Apexpages.StandardController sc = new Apexpages.StandardController(myaccount);
        PartnerLeadController partlead = new PartnerLeadController(sc);   
        partlead.getlead();
        partlead.initlead();
    }
   
}
I have written the eblow code to display partner leads. Can u fix the error for me and help  me in writing test class for the same

Apex class
public class PartnerLeadController {
    public class PartnerLeadsController {
    
    private final Lead l;
    
    public PartnerLeadsController(ApexPages.StandardController stdController) {
        this.l = (Lead)stdController.getRecord();
        initlead();
    }
    
    List<Lead> lead;
    
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName from Lead where Partner_Name__c = :l.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    }
    
    public List<Lead> getlead () {
        return lead;
    }   
    
}

           

}

Vf page

public class PartnerLeadController {
    public class PartnerLeadsController {
    
    private final Lead l;
    
    public PartnerLeadsController(ApexPages.StandardController stdController) {
        this.l = (Lead)stdController.getRecord();
        initlead();
    }
    
    List<Lead> lead;
    
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName from Lead where Partner_Name__c = :l.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    }
    
    public List<Lead> getlead () {
        return lead;
    }   
    
}

           

}

User-added image
I have written a test class to create PDF but logic is not working can anyone help me with the test class

Apex Class

public class QuotePDF {
    public boolean show{get;set;}
    public id pdtId{get;set;}
    public Quote op{get;set;}
    public QuoteLineItem oli{get;set;}
    public string pb{get;set;}
    public Id opid{get;set;}
    public id prodid{get;set;}
    public list<QuoteLineItem> OliList{get;set;}
    public list<Quotelineitem> OliCreate;
    public integer deleteIndex{get;set;}
    
    public QuotePDF()
    {
        show=false;
        oli=new QuoteLineItem();
        op=new Quote();
        OliList=new list<QuoteLineItem>();
        OliCreate=new list<Quotelineitem>();
    }
    
    public void save(){
        pricebook2 spbid=[select id from pricebook2 where isStandard=true limit 1];
        
        opportunity o1=[select id from opportunity limit 1];
        op.OpportunityId=o1.id;
        op.Pricebook2Id=spbid.id;
        upsert op;
        map<id,id>pdtTopbemap=new map<id,id>();
        
        for(pricebookentry pb:[select product2id,id from pricebookentry where pricebook2id =:spbid.id ])
        {
            pdtTopbemap.put(pb.product2id,pb.id);
        }
        for(QuoteLineItem o:OliList)
        {
            o.QuoteId=op.id;
            o.unitprice=o.unitprice; 
            o.quantity=o.quantity;
            o.pricebookentryid=pdtTopbemap.get(o.product2id);
            o.Product2Id=o.product2id;
            OliCreate.add(o);
        }
        insert OliCreate;
    }
    public void AddOli()
    {
        show=true;
        QuoteLineItem olitemp = new QuoteLineItem();
        OliList.add(olitemp);
    }
    
    public void deleteOpp()
    {
        OliList.remove(deleteIndex);
    }
}

Test Class

@isTest
Public class QuoteApexClassTest {
    @isTest public static void QuoteApextestMethod() {
        Opportunities__c opp = new Opportunities__c();
        opp.Name = 'TestOpp';
        opp.Close_Date__c = System.today() + 5;
        opp.Stage__c = 'Prospecting';
        Insert opp;
        
        Quotes__c q = new Quotes__c();
        q.Name = 'test';
        q.OpportunityId__c = opp.Id;
        Insert q;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(q);
        PageReference pageRef = Page.QuoteTemplate;
        pageRef.getParameters().put('id', String.valueOf(q.Id));
        Test.setCurrentPage(pageRef);
        
        QuoteApexClass qac = new QuoteApexClass(sc);        
        qac.saveQuoteAsPDFandEmail();
         
        qac.print();
    } 
}