• Rajesh3699
  • NEWBIE
  • 275 Points
  • Member since 2016

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 95
    Replies
I have a custom object Student in which I want to give a unique value to Class roll number field. I am creating a trigger for that. Can you please tell me how to achieve the same in Apex. New here
trigger RollCheck on Student__c (before insert) {
    
    List<Student__c> los = new List<Student__c>();
    
    for(Student__c student: trigger.new){
        student = new Student__c(id = student.id);
        
        if(student.Class_Roll_Number__c == null){
            System.debug('Roll Number is already assigned');
        }
        else{
             #This part. Help me figure it out please?


        }
            
    }

}
I am trying to use a custom controller to get back case comments for a particular case (case id will be in URL).  I need to do this so I can sort columns (very annoying that Salesforce doesn't allow this with dataTables).  Right now I'm just trying to get some data back from my controller and failing miserably.

How can I do this?

So far this doesn't work....
****My test VF page****
<apex:page standardController="Case" extensions="TestController"> 
    <apex:form >   
        <apex:pageBlock title="{!Case.CaseNumber}"> 
			TEST:{!caseComm[0].CommentBody}
        </apex:pageBlock>   
    </apex:form>  
</apex:page>
***My test controller***
public class TestController {
    public List<Case> caseComm {get;set;}
    
    public TestController(ApexPages.StandardController controller) {
		
    }
    
    public List<Case> caseComm() {   
		List<Case> comments = [Select (Select Id, 
                            ParentId,  
                            IsPublished, 
                            CommentBody, 
                            CreatedById, 
                            CreatedDate,                  
                            LastModifiedDate, 
                            LastModifiedById, 
                            From CaseComments) From Case ];
        return comments;
    }
    
    
}


 
Hi All,
Through custom coding and not a configuration.
I want to Map Contact to Opportunity Custom field while converting Lead.
I'm able to map Existing contact and Account name but after conveting Lead newly created contact i need to Map.Please any one have any Idea?


Thanks
KMK
  • March 25, 2019
  • Like
  • 0
hello , i am not being able to run my test class for this controller , 

public class addLaborProposalCntrl {
    Public string leadID{get;set;}
    Public string testlpropID{get;set;}
    Public Lead lead {get;set;}
    Public Laborer_Mid_Construction_Proposal__c lprop {get;set;}
    Public Laborer_Mid_Construction_Proposal__c testlprop {get;set;}

    
    public addLaborProposalCntrl () {                  
    testlprop = [SELECT Marketing_Material__c, Holiday_Coverage__c,Management_and_Supervision__c, Over_Time_Hours__c, Pricing__c , Payment_Terms__c,Statement_of_Work__c,Supplies_and_Equipment__c FROM Laborer_Mid_Construction_Proposal__c where Name LIKE 'Test%' Limit 1 ];
    leadID = apexpages.currentpage().getparameters().get('id');
    lead = new Lead(ID = leadID);
    lprop = new Laborer_Mid_Construction_Proposal__c(Lead__c = LeadID );
    
    }
Public PageReference saveRecordlprop(){
upsert lead;
update testlprop ; 
lprop.Marketing_Material__c = testlprop.Marketing_Material__c;
lprop.Holiday_Coverage__c = testlprop.Holiday_Coverage__c;
lprop.Management_and_Supervision__c = testlprop.Management_and_Supervision__c ;
lprop.Over_Time_Hours__c = testlprop.Over_Time_Hours__c ;
lprop.Payment_Terms__c = testlprop.Payment_Terms__c ;
lprop.Pricing__c = testlprop.Pricing__c ;
lprop.Statement_of_Work__c = testlprop.Statement_of_Work__c  ;
lprop.Supplies_and_Equipment__c = testlprop.Supplies_and_Equipment__c ;
upsert lprop;  
    PageReference p = new PageReference('/' + this.lprop.Id );
    return p;
}


}

this is my Test Class 

@isTest 
public class addLaborProposalCntrlTest{

static testMethod void testMethod1() {

        Lead testRecord= new Lead();
        
        testRecord.LastName = 'test name ';
        testRecord.Company = 'test company';
        testRecord.Status = 'new';
        testRecord.Credit_Limit_Amount__c = 12344;
        insert testRecord;

        Laborer_Mid_Construction_Proposal__c testRecord2 = new Laborer_Mid_Construction_Proposal__c();
        testRecord2.Lead__C = testRecord.ID;
        testRecord2.Marketing_Material__c = 'test';
        testRecord2.Holiday_Coverage__c = 'test';
        testRecord2.Management_and_Supervision__c = 'test';
        testRecord2.Over_Time_Hours__c = 'test';
        testRecord2.Payment_Terms__c = 'test';
        testRecord2.Pricing__c = 'test';
        testRecord2.Statement_of_Work__c = 'test';
        testRecord2.Supplies_and_Equipment__c = 'test';
        
        
        testRecord2.Name = 'test';
        insert testRecord2;
        
        update testRecord2;
        


        Test.setCurrentPage(Page.addJob);
        System.currentPageReference().getParameters().put('id', testRecord2.Id);
        
        addLaborProposalCntrl addjobCntrlTestIns = new addLaborProposalCntrl();
        
        addjobCntrlTestIns.saveRecordlprop();
    }
 }

it gives this error 

System.TypeException: Invalid id value for this SObject type: a091g0000085HO8AAM error 

can anyone please help me in this 
 
Create a Vf page Which displays Accounts Name and related contact[Picklist] in a table format and Having a button in the last Column ""Delete"".It will delete the account and all the contacts related to the account."
Hi All,
We have a trigger on our case object that summarizes a number field on each related activity when that case closes.  Problem is the trigger only works for some employees for some reason. I have a debug file for a user when the trigger fails but the file its too long to post on this forum (I can only paste 32,000 characters in a post. What should i do to go about solving this issue? I have a feeling the issue is a very simple fix for someone that uderstands apex code well.

Thanks!





 
Hi,am sharing screen shot for need to dipsly related contacts of Account and selected record needs to be delete for this I need VF page code and controller 
User-added image
I'm trying to complete the Trailhead: Customize a Sales Path for Your Team > Customize Opportunity Stages.  One of the steps is adding the field "Main Competitors" to the Needs Analysis tab in the Path.  I can't find that field as an option.  Oddly, I can't find that as an Opportunity field in any of my orgs.  I tried adding it both as a custom text area and a multi-picklist.  Neither succeeded.  I can't complete the trail because I keep getting an error on that step.

Any ideas what I need to do?
As the above mentioned critical update will be activated by Jan 2021, can someone post a sample code, which may cause error post this activation.
I could not completely understand what does salesforce mean by Function Expressions, are they saying we cannot call any functions which inturn returns the value for the specified label or attibute...

I saw some of the sample code but wanted to be more sure about this release update.
https://salesforce.stackexchange.com/questions/280965/example-for-banning-functions-in-a-createcomponent-after-spring19
https://salesforce.stackexchange.com/questions/278743/aura-component-critical-updates-related-to-a-createcomponent-or-a-createcomp


Thank You,


 
We want to add some lightning component as a related list under AccountContactRelation object, hence we want to customize the layout and drag & drop the component. The standard button Edit Page [from which we can customize the lightning view / add some relarted sub tabs / lightning components ] option is not available for AccountContactRelation object.

Does someone has faced the same issue, though I know we have some limitation for AccountContactRelation object, I could not find any help articles / known issue link for the above mentioned issue.

Thank You,
Rajesh Adiga P.
Hello All,

Is there any way where we can extract or calculate the code covergae of all the classses...?

We have more than 300 classes in our org, where aorund 100 odd classes coverage has been dropped, so I want to know the classes where the coverage is less than 60%.

I have gone through this link : https://help.salesforce.com/articleView?id=000332406&type=1&mode=1

https://developer.salesforce.com/forums/?id=906F0000000BVBuIAO
Suggest me apart from the above mentioned steps

Thank You,
Rajesh Adiga P.
Hello All,

Its been mentioned in  the Apex Guide that, we can keep track of the email i,e number of times the email has been opened etc.
We have this option  mail.setSaveAsActivity(true) that will create a activity in salesforce for specific record, but that does not show up how many times the email has been opened / not opened.

Can we someone let me know how we can achieve this..?
User-added image
Hello All,

I have 3 questions.

1. In Pardot, the prospect shows as Never Actiive, and I have read that, only by opening a form, visiting webpages, clicking a link can make a prospect as active, Is that true...?

Is there a way apart from above to make a prospect active...?

2. If the prospect is shown as never active, can we not send emails using Automation rules..?

3. Say for ex: 5 prospects are matched to the automation rule criteria, and after I make the Automation rule to resume. Will the action associated with the Automation rule start performing for the 5 prospect or how ..?

Thank You
 
I have a requirement where I have to update a field named Send_Purchase_Notification__c on Contact whenever an Opportunity Stage is marked as ''Closed Won. Is there any way of achieving this requirement non - programmatically?
We want to add some lightning component as a related list under AccountContactRelation object, hence we want to customize the layout and drag & drop the component. The standard button Edit Page [from which we can customize the lightning view / add some relarted sub tabs / lightning components ] option is not available for AccountContactRelation object.

Does someone has faced the same issue, though I know we have some limitation for AccountContactRelation object, I could not find any help articles / known issue link for the above mentioned issue.

Thank You,
Rajesh Adiga P.
Hi 
i am having 2 issus, can u pls help on this :
1. How can i place below data Into Map :
(
        caseInfoWrapper:
        [carrierId=, 
        partyId=a1K2F000000lWJrUAM, 
        product=SI, 
        productType=Whole Life, 
        stateId=AK]
        )

2. When calling Wrapper class from one class to another class getting below error :
Illegal assignment from List<NewCtr.caseInfoWrapper> to List<String>

global class NewCtr {
public static List<caseInfoWrapper> caseInfoWrapperRecords(List<ATD_Application__c> applicationList,Id partyId){
      List<caseInfoWrapper> lsCaseWrappers = new List<caseInfoWrapper>();
        for(ATD_Application__c caseInfo : applicationList){
            caseInfoWrapper wrapper = new caseInfoWrapper();
            wrapper.partyId = caseInfo.Party__c;
            wrapper.productType = 'Whole Life';
            lsCaseWrappers.add(wrapper);
            system.debug('lsCaseWrappers***'+lsCaseWrappers);
        }
        return lsCaseWrappers;
    }
    
    }
    
global with sharing class NewHandler {

    list<caseInfoWrapper> wrapperRecords = NewCtr.caseInfoWrapperRecords(applicationList,partyId);
}
  • July 10, 2020
  • Like
  • 0
Hi all,
I created an interface, in which the classes that implement this interface has future methods for calling external web services. For some reason it seems that Apex is not recognizing the @future(callout = true) argument and give me the error: callouts from triggers are not supported (the methods are being invoked by a trigger). Things work fine once I remove the implementation of the interface from the class. I attached code snippets for each Apex class/trigger below:The interface I haveAn example class that implements the interface, the addUser is a future method that calls an external service, and it is being invoke by a trigger.The trigger that invoke the class's method using reflection. 
I'll be extremely thankful if someone could help!
Hi everyone,

We are working on consolidating some of our workflow rules into process builders and so far we have done so by through using the UI. 

I read that it is possible to access workflow rules and process builder metadata, but is there a way to create a new process builder from the workflow rules using just the API?

Thanks for any help/recommendations.
I have a custom object Student in which I want to give a unique value to Class roll number field. I am creating a trigger for that. Can you please tell me how to achieve the same in Apex. New here
trigger RollCheck on Student__c (before insert) {
    
    List<Student__c> los = new List<Student__c>();
    
    for(Student__c student: trigger.new){
        student = new Student__c(id = student.id);
        
        if(student.Class_Roll_Number__c == null){
            System.debug('Roll Number is already assigned');
        }
        else{
             #This part. Help me figure it out please?


        }
            
    }

}
Hello,

I have a Custom_picklist__c on Parent_Obect__c with value1 and Value2
I have a child object child_Custom__c i have check box on this object Custom_checkbox1__c

Parent_Obect__c
  Custom_picklist__c (value1, Value2)

child_Custom__c
  Custom_checkbox1__c
    
Usecase:
On creation of new record of child_Custom__c  the field Custom_checkbox1__c will be if Custom_picklist__c = Value1

How can implement a trigger for the same ?

thank you for suggestion 
  • September 17, 2019
  • Like
  • 0
I have written a test on invocable apex class used in process builder and its failed. plz find the below code and help me out where i am going wrong also atteched the error 

Error --
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Account Owner Change” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow.  Please contact your system administrator for more information.: []

code --
@isTest
public class RequestPortalRecordsTest {

    static testMethod void OwnerUpdateMethodTest() {
        Test.startTest();
        Food_Service_Bulk_Data_Processing_Limit__c c=new Food_Service_Bulk_Data_Processing_Limit__c();
        c.Name='Default';
        c.Batch_Size__c=200;
        insert c;
        
          Account acc = new Account();
          acc.Name = 'TestAccount';
         acc.Rating='Active';
       insert acc;
       Request_Portal__c rp = new Request_Portal__c ();
        rp.Account_Name__c = acc.id;
        insert rp;
        //rpList.add(rp);
        List<Request_Portal__c> rpList = new List<Request_Portal__c> ();
        RequestPortalRecords.ReqChange(rpList);
         Test.stopTest();
         //  public static void ReqChange(List<Request_Portal__c> rp)
        
    }
}

Hi,
I'm creating a Workflow rule. My requirement is to send an email when the criteria and formula meet.
Whenever a new Lead is created and Lead Stage =Marketing Qualified or Lead owner is edited. It will trigger an email.

My Formula:AND( 
Text(Status)= 'Marketing Qualified', 
OR(isChanged(OwnerId), isChanged(Status), isChanged(Number_of_Form_Submissions__c), isNew()) 
)
Please any one help me on this.

Thanks
Vivek

Hi,

-i want image placed in side by side but i will show vertically.
- requrement is simple:

- i want grand chaild of image URL field Show on Parent object. 
IP(Parent Object) --> WO(Child Object) --- Grand Child(SI)

*******APEX controller***********************

public class WorkOrdersInstaIPTemplateSharinPixImage{
    
    public List<IP_Template__c> IPTemplateLst {get;set;}
    public List<String> urlList {get;set;}
    
    
    public Map<String, List<ImageParam>> urlString{get;set;}
    
    
    public Boolean hasNoImage{set;get{
        return urlString.size()==0?true:false;
    }}
    
    public  WorkOrdersInstaIPTemplateSharinPixImage (ApexPages.StandardController stdCtrl) {
        
        
        
        Id workOrderId = stdCtrl.getId();   // Work order ID
        
        urlString= new Map<String, List<ImageParam>>();
        
        Set <ID> installedProductSet= new Set <ID>();  // SET of Installed Product ID
        
        System.debug('Installed Product :' + installedProductSet);
        
        List<SVMXC__Service_Order__c> workOrderLSt = new  List<SVMXC__Service_Order__c>(); //List Of Work Order
        
        workOrderLSt=[select Id,SVMXC__Component__c,IP_Template_Type__c from SVMXC__Service_Order__c where Id = :workOrderId AND IP_Template_Type__c !=NUll]; //Fetch the Wo related Installed Product
        
        for(SVMXC__Service_Order__c woInstall: workOrderLSt)
        {
            system.debug('woInstall.SVMXC__Component__c:- '+woInstall.SVMXC__Component__c);
            installedProductSet.add(woInstall.SVMXC__Component__c);
            system.debug('installedProductSet:- '+installedProductSet);
        }
        
        IPTemplateLst= [SELECT
                        Id,Type__c,Installed_Product__c,Title__c,
                        (Select Id, sharinpix__ImageURLFull__c,Landscape_Portrait__c,sharinpix__FileName__c, sharinpix__AlbumID__c FROM SharinPix_Images__r order by sharinpix__SortPosition__c ASC),
                        (SELECT Id, sharinpix__SharinPix_Token__c FROM SharinPix_Albums__r)
                        FROM IP_Template__c
                        Where Installed_Product__c IN:installedProductSet AND Type__c!=Null
                        ORDER BY
                        Title__c
                        ASC]; //Fetch the IP temate related to Installed Product
        
        urlList= new List<String>();
        
        System.debug('IPTemplateLst :'+IPTemplateLst);
        
        
        List<IP_Template__c> IPTemplate = new List<IP_Template__c>(); 
        
        For(IP_Template__c  ip: IPTemplateLst)
        {
            For(SVMXC__Service_Order__c work:workOrderLSt)
            {
                if((ip.Installed_Product__c==work.SVMXC__Component__c)&& (ip.Type__c==work.IP_Template_Type__c ))
                {
                    IPTemplate.add(ip);
                }
                
            }            
        }        
        
        for(IP_Template__c titleUrl:IPTemplateLst) 
        {
            List<ImageParam> urlValues = new List<ImageParam>();
            for(SVMXC__Service_Order__c work:workOrderLSt){
                
                if((titleUrl.Installed_Product__c==work.SVMXC__Component__c)&& (titleUrl.Type__c==work.IP_Template_Type__c ) )
                { 
                    for(sharinpix__SharinPixImage__c b: titleUrl.SharinPix_Images__r)
                    {
                        urlValues.add(new ImageParam(b, titleUrl.SharinPix_Albums__r[0].sharinpix__SharinPix_Token__c));                
                    }
                    urlString.put(titleUrl.Title__c, urlValues);     
                }
            }
            
        }
        System.debug('urlString :'+urlString);
        
    }
    
    public class ImageParam{
        public String imageUrl{set;get;}
        public String albumId{set;get;}
        public String tokenString{set;get;}
        public String LandscapePortrait{set;get;}
        public String fileName{set;get;}
        
        
        public ImageParam(sharinpix__SharinPixImage__c img, String tokenString){
            this.imageUrl = img.sharinpix__ImageURLFull__c;
            this.albumId = img.sharinpix__AlbumID__c;
            this.LandscapePortrait = img.Landscape_Portrait__c;
            this.fileName = img.sharinpix__FileName__c;
            
            
             sharinpix.Client spClient = sharinpix.Client.getInstance();
            Map<String, Object> params = new Map<String, Object> {
            	'album_id' => albumId,
            	'path' => '/pagelayout/'+albumId,
            	'exp' => (DateTime.now().getTime()/1000) + 300,
                'Id' => albumId,
            	'abilities' => new Map<String, Object> {
                    'tags' => new Map<String, Object> {
                           'read' => true     
                      },
					albumId => new Map<String, Object> {
						'Access' => new Map<String, Object> {
                            'see' => true,
                            'image_list' => true,
                            'image_upload' => true,
                            'image_delete' => true,
                            'image_annotate' => true,
                            'image_tag' => true
	                 	},
                        'Display' => new Map<String, Object>{
                            'see' => true,
                            'tags' => true,
                            'date' => 'L'
                         }		
					}
            	}
            };
            this.tokenString = spClient.token(params);
         }
    }
}
************* VF code***************
 
<apex:page standardController="SVMXC__Service_Order__c" extensions="WorkOrdersInstaIPTemplateSharinPixImage">
    <apex:form >
        <apex:pageBlock rendered="{! !hasNoImage}">
            
            <apex:outputPanel style="overflow:hidden; height:100%"> 
                <apex:pageBlockTable value="{!urlString}"  var="title" >
                    <apex:column style="vertical-align: top;">
                        <apex:facet name="header">Title</apex:facet>
                        {!title}
                    </apex:column>
                    <apex:column >
                        <apex:facet name="header">IP Template Images</apex:facet>  
                        
                        <apex:panelGrid columns="5">
                            <apex:repeat value="{!urlString[title]}" var="img">
                                
                                <table>
                                    <tr>
                                        <td>
                                            
                                            <figure style="margin-left: -0.5rem;">
                                                <a href="javascript:void(0);"
                                                   onclick="openImage('{! img.albumId }', '{! img.tokenString}')" >
                                                    
                                                    <img src="{!img.imageUrl}" height="150" width="160" alt="img not available" style= "display: block; padding-right: 0.5rem; padding-left: 0.5rem; padding-top: 1rem; margin:0" />
                                                    
                                                </a>
                                                <figCaption style='font-size: smaller;'>&nbsp;&nbsp;{! img.fileName } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{! img.LandscapePortrait }</figCaption>
                                            </figure>
                                            
                                        </td>
                                    </tr>
                                </table>    
                            </apex:repeat>
                        </apex:panelGrid>
                        
                        
                        
                    </apex:column>
                </apex:pageBlockTable>
                
            </apex:outputPanel>
        </apex:pageBlock>
        
        <apex:outputPanel rendered="{!hasNoImage}">
            <span style="background-color: #FFFFFF; font-size: 300%; height: 700px; width: 600px;">
                <br/>
                No Image Found
            </span>
        </apex:outputPanel>
        
    </apex:form>
    <script> 
    function openImage(albumId, tokenString){
        window.open('https://app.sharinpix.com/pagelayout/'+albumId+'?fullscreen=false&token='+tokenString)
    }
    </script>
    <!--    <sharinpix:SharinPix parameters="{! parameters }" height="500px"></sharinpix:SharinPix> -->
    
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/> 
    <style>
        .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
        min-width: 5rem;
        }
        
    </style>
</apex:page>

*******OUTPUT****************

User-added image​​​​​​​
I am trying to use a custom controller to get back case comments for a particular case (case id will be in URL).  I need to do this so I can sort columns (very annoying that Salesforce doesn't allow this with dataTables).  Right now I'm just trying to get some data back from my controller and failing miserably.

How can I do this?

So far this doesn't work....
****My test VF page****
<apex:page standardController="Case" extensions="TestController"> 
    <apex:form >   
        <apex:pageBlock title="{!Case.CaseNumber}"> 
			TEST:{!caseComm[0].CommentBody}
        </apex:pageBlock>   
    </apex:form>  
</apex:page>
***My test controller***
public class TestController {
    public List<Case> caseComm {get;set;}
    
    public TestController(ApexPages.StandardController controller) {
		
    }
    
    public List<Case> caseComm() {   
		List<Case> comments = [Select (Select Id, 
                            ParentId,  
                            IsPublished, 
                            CommentBody, 
                            CreatedById, 
                            CreatedDate,                  
                            LastModifiedDate, 
                            LastModifiedById, 
                            From CaseComments) From Case ];
        return comments;
    }
    
    
}


 
Wondering if I get an email with the most recent case comment and I reply back, is there a way to have it save as a case comment in the case it came from?  We do not use email-to-case as we don't want cases created from emails.  Just want the emails someone replies to to save as a case comment on the case they came from. 
  • April 01, 2019
  • Like
  • 0
Hi Guys,

I have designed class to send email to opprotunity contact roles. i need to write test class for below class
 
public class OppsendEmail {   
    
    public String subject {get; set;}
    public String body {get; set;}
    public blob attbody {get; set;}
    public String attname {get; set;}
    public String sendTo {get; set;}
    public list<string> toAddresses {get; set;}
    
   // public String Opportunity.Contact__c {get; set;}
    public String oppList {get; set;}
    public list<document> docList {get; set;}
    public List<Opportunity> Opp = new list<Opportunity>();
    public Map<Id, Opportunity> relatedOppMap = new Map<Id, Opportunity>();
    List<OpportunityContactRole> contactRoleArray = new List<OpportunityContactRole>();
    List<Contact> ContactList = new List<Contact>();
    public List<AttchCls> attchLst {set;get;}
    public String currentUserEmail {get; set;}
    // Custom Label
    public string customLabelValue{get;set;}   
    public String accountnumber { get; set; }
    public String accountid { get; set; }
    public Opportunity Opportu {get;set;}
    ApexPages.StandardController controller;
  
    
    /* Content */
    public string content { get; set; }
    public transient  ContentVersion contentRecord { get; set; } 
    
    // Constructor to get Opportunity data
    public OppsendEmail(ApexPages.StandardController controller){     
        
        contentRecord = [select id, Title, VersionData, PathOnClient, FileExtension from ContentVersion 
                         where ContentDocumentId =: system.Label.New_Project_Survey_ID LImit 1];
        
        content = contentRecord.Title;      
        this.controller = controller;
         Opportu = (Opportunity)controller.getRecord();
         system.debug('Opportu'+Opportu.Contact__c);

        
        
        
        opp = [Select OwnerId, (Select OpportunityId, Contact.Email From OpportunityContactRoles) From Opportunity 
                                where id in (Select OpportunityId From OpportunityContactRole where ContactId != '') 
                                AND Id =: ApexPages.currentPage().getParameters().get('id')];
        
        system.debug('ApexPages.currentPage().getParameters().get() >>>>>. Line 19'+ApexPages.currentPage().getParameters().get('id'));
        contactRoleArray =[select ContactID, Contact.Email, isPrimary, opportunityId from OpportunityContactRole Where isPrimary = true AND opportunityId =: ApexPages.currentPage().getParameters().get('id')];
        currentUserEmail = UserInfo.getUserEmail();
        body = 'Default body';
        subject = 'Default subject';
        system.debug('contactRoleArray >>>>> Line 18  '+contactRoleArray);
        system.debug('Emaillist >>>>>. Line 34'+sendTo);
        system.debug('currentUserEmail >>>>>. Line 28'+currentUserEmail );
        
    }
    
  
    
    public void PopulateAccNumber() {
     contactRoleArray =[select ContactID, Contact.Email, isPrimary  from OpportunityContactRole Where isPrimary = true AND opportunityId =: ApexPages.currentPage().getParameters().get('id')];
       
    }
    
    public PageReference uploadPDF(){
        
        String CurrentLoginUserId = UserInfo.getUserId();
        Opportu = (Opportunity)controller.getRecord();
        Id ContactID = Opportu.Contact__c;
        system.debug('Opportu'+Opportu.Contact__c+'   '+'ContactID   '+ContactID);        
        sendTo = [SELECT Id, Email, Name From Contact WHERE Id =: ContactID].Email;
        system.debug('sendTo Line 75 >>>'+sendTo);


        try {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();  
            customLabelValue = System.Label.New_Project_Survey_ID;          
            transient ContentVersion  cv_list = [select id, Title, VersionData, PathOnClient, FileExtension from ContentVersion 
                                                    where ContentDocumentId = : customLabelValue LImit 1];
            string EamilAttTitle = cv_list.Title+'.'+cv_list.FileExtension;
            transient Blob b = cv_list.versionData;
            
            // Create the email attachment
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName(EamilAttTitle); 
            efa.setBody(b);
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            email.setSubject(subject);
            String[] toAddresses = new String[]{SendTo};
            String[] currentUserEmails = new String[]{currentUserEmail};
            email.setToAddresses( toAddresses );
            email.setccAddresses(currentUserEmails);
            email.setPlainTextBody(body);
            
            String[] ccAddresses = new String[] {currentUserEmail};
            // Sends the email  
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
            
            List<Task> taskList = new List<Task>();
            for(Opportunity Op : opp){
                   Op.Survey_Sent_Date__c = Date.today(); 
                   Op.Survey_Status__c = 'Sent';
                   
                       Task newTask = new Task(
                       WhatId = op.Id,                    
                       OwnerId = CurrentLoginUserId ,                    
                       ActivityDate = Date.today(),
                       Subject = 'New Project Survey Sent',
                       Description = ' ',
                       WhoId = ContactID 
                       );
                taskList.add(newTask);
                 
            }                
            update opp;
            insert taskList;
            
         Id Opport = ApexPages.currentPage().getParameters().get('id');
         system.debug('Opport 95'+Opport);
         PageReference pgref = new PageReference('/' + Opport);
         pgref.setRedirect(true);
         return pgref;
        }
        catch(exception e){
            system.debug('Error:'+e);
            apexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,'e-'+e));
        }
        finally{
            
        }
        return null;
    }
    public class AttchCls{
        public boolean isSel {set;get;}
        public boolean ishd {set;get;} 
        public id cvId {set;get;}
        public Attachment att {set;get;}
    }
    
     
    
}
Started test class
 
@isTest
public class OppsendEmailTest{
    static testMethod void createAccount(){
        Account a = new Account();
        a.Name = 'Test Co.';
        a.BillingStreet = '4332 Holden Street';
        a.BillingCity = 'San Diego';
        a.BillingState = 'California';
        a.BillingPostalCode = '92101';
        a.BillingCountry = 'United States';
        a.Phone = '501-555-5555';
        a.Website = 'www.testco.com';
        insert a;
        System.debug('created account');
            
        //Then create a primary contact
        Contact c = new Contact();
        c.FirstName = 'Paul';
        c.LastName  = 'Test';
        c.AccountId = a.id;
        c.MailingStreet = '298 S. Ringo Street';
        c.MailingCity = 'San Diego';
        c.MailingState = 'California';
        c.MailingPostalCode = '92101';  
        c.MailingCountry = 'United States';       
        insert c;
        System.debug('created primary contact');
            
        //Then create another non-primary contact
        Contact ci = new Contact();
        ci.FirstName = 'Bob';
        ci.LastName  = 'Test';
        ci.AccountId = a.id;
        ci.MailingStreet = '298 S. Ringo Street';
        ci.MailingCity = 'San Diego';
        ci.MailingState = 'California';
        ci.MailingPostalCode = '92101'; 
        ci.MailingCountry = 'United States';
        insert ci;
        System.debug('created primary contact');
            
        //Now create an opportunity
        Opportunity o = new Opportunity();
        o.RecordType = [SELECT Id, Name, DeveloperName FROM RecordType WHERE Name = 'Airway Opportunity' LIMIT 1];
        o.Name = 'New Record';
        o.StageName = 'Posted';
        o.CloseDate = Date.today();
        o.Description = 'Test Record';
        insert o;
        System.debug('created opportunity');
            
        //Now update the OCR for the primary contact
        OpportunityContactRole ocr = new OpportunityContactRole();
        ocr.ContactId = c.Id;
        ocr.OpportunityId = o.Id;
        ocr.IsPrimary = TRUE;
        ocr.Role = 'Decision Maker';
        insert ocr;
        System.debug('created opportunity contact role for primary');
            
        //Now update the OCR for the non-primary contact
        OpportunityContactRole ocr1 = new OpportunityContactRole();
            
        ocr1.ContactId = ci.Id;
        ocr1.OpportunityId = o.Id;
        ocr1.IsPrimary = FALSE;
        ocr1.Role = 'Decision Maker';
        insert ocr1;
        System.debug('created opportunity contact role for non-primary contact');
        
        Update o;           
    }
}

iam unable to pass data into test class . Help me to design test class
 
Dear Folks,

Facing an error while deploying Chat Button. Routing type is Omni channel queues. But the error is showing related to Skill.
Routing type is Omni channel queues

What am i missing?