• Rishab Tyagi
  • NEWBIE
  • 207 Points
  • Member since 2018
  • Salesforce Admin

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 39
    Replies
I'm trying to learn how to write a trigger that calls a class. When trying to deploy I'm getting this error "Trigger does not exist: Trigger"
Here's my Trigger:
trigger MasterOnboardingTrigger on Onboarding__c (
    before insert, after insert, 
    before update, after update, 
    before delete, after delete) {

    if (Trigger.isBefore) {
        if (Trigger.isInsert) {
        // Call class logic here!
        } 
        if (Trigger.isUpdate) {
        // Call class logic here!
        FulfillmentFirst ful = new FulfillmentFirst(Trigger.new);
        }
        if (Trigger.isDelete) {
        // Call class logic here!
        }
    }

    if (Trigger.IsAfter) {
        if (Trigger.isInsert) {
        // Call class logic here!
        } 
        if (Trigger.isUpdate) {
        // Call class logic here!
        }
        if (Trigger.isDelete) {
        // Call class logic here!
        }
    }
}
And here's my class:
public class FulfillmentFirst {
    // This will hold the onboarding record passed by the trigger
    List<Onboarding__c> onbs; 
    

    public FulfillmentFirst (List<Onboarding__c> triggerOnb) {
        onbs  = triggerOnb;
    }

    public void CreateFirstFulfillment(){
        for(Onboarding__c onb : onbs){
            if(onb.Fulfillment_Created__c = false){
                // Engage
                if(onb.Product__c == 'Engage'){
                    Fulfillment__c enFul = new Fulfillment__c();
                    enFul.Name                   = 'Engage First Fulfillment + ' + onb.Account__r.Name;
                    enFul.Status__c            = 'Not Started';
                    enFul.Account__c       = onb.Account__c;
                    enFul.Due_Date__c    = Date.today().addDays(14);
                    enFul.RecordTypeId  = '0121I000000G1dkQAC';
                    insert enFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }

                // Social Ads
                if(onb.Product__c == 'Social Ads'){
                    Fulfillment__c saFul = new Fulfillment__c();
                    saFul.Name                   = 'Social Ads First Fulfillment + ' + onb.Account__r.Name;
                    saFul.Status__c            = 'Not Started';
                    saFul.Account__c       = onb.Account__c;
                    saFul.Due_Date__c   = Date.today().addDays(14);
                    saFul.RecordTypeId = '0121I000000G1dmQAC';
                    insert saFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }

                // Social Posting
                if(onb.Product__c == 'Social Posting'){
                    Fulfillment__c spFul = new Fulfillment__c();
                    spFul.Name                   = 'Social Posting First Fulfillment + ' + onb.Account__r.Name;
                    spFul.Status__c            = 'Not Started';
                    spFul.Account__c       = onb.Account__c;
                    spFul.Due_Date__c   = Date.today().addDays(14);
                    spFul.RecordTypeId = '0121I000000G1doQAC';
                    insert spFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }
            }
        }
    }
}
Any help would be much appreciated.
Hi,

I'm a beginner with Visualforce, so please excuse my stupidity.

I'm pulling my hair out trying to get output text to render when there is more than one condition.  If it's just one, there's no problem.  However, the second I want to use OR or AND (and I've tried it 50 different ways), it will not work for me.  I'm just trying to render something in the email if the opportunity stage is either "Verbal" or "Closed Won".  I'm not using any custom controller as it didn't seem necessary.  This is what the code currently looks like:

<apex:outputPanel rendered="{!(relatedTo.StageName =='Verbal' || relatedTo.StageName =='Closed Won')}">
Block of verbage.
</ apex:outputPanel>

I have tried it with OR() as well.  I've tried having the "!" on both relatedTo segments, and many others.  I've looked all over for the answer, and none of the fixes seem to work for me.

Thank you!
I am very new to writing apex code and have come to a roadblock when it comes to moving the updated Visualforce page I've helped edit out of the sandbox and into production. When I created the changeset I added the visual force page and associate apex class that I've been working in. When I went to validate this change set in production I got several component errors. Namely that a certain variable doesn't exist and that the apex class I thought I'd created didn't exist as well.

Below I've attached the code where several of the errors exist namely that the Variable: Special_Skills__c doesn't exist. I have done some trailheads and googled other questions to get to the point where the visualforce page created is exactly what we are looking for. I just need some help in overcoming these errors so that I can get this into production ASAP in addition to increasing my knowledge of code and working in a sandbox and ultimately transferring this information into production. Thanks in advance!

//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   } 
   
 
I need to retrieve  the records ( All opportunities with Closed won )  on selection of a checkbox (inputcheckbox)  on click of SEARCH command button on the page.
 
after searching around, all I have seen are references to using a wrapper class, which seems a little bit overboard for what I am looking to do. I am beginner in developer role. I am using the below code..

public class inputcheckbox{

    public boolean mycheckval { get; set; }
    public inputcheckbox() {
    mycheckval = false;
    }
    List<Opportunity> Opr;
    public List<Opportunity> getopr(){
        return opr;
    }
        public void closedWon(){
        if(mycheckval) {
        
        opr= [select name, stagename, closedate, expectedrevenue, probability from Opportunity where stagename= 'closed won'];
        
        //return null;
        }
    }   
        
}
VF:---

apex:page controller="inputcheckbox" sidebar="false" showHeader="false">
<apex:form >
            <apex:pageblock title="Search opportunity by stage"> 
        
            <apex:inputcheckbox value="{!mycheckval}" />
     
                  
            <apex:commandButton value="search" action="{!closedwon}"/>
            
            <apex:pageBlockTable value="{!opr}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.stagename}"/>
                <apex:column value="{!a.closedate}"/>
                <apex:column value="{!a.expectedrevenue}"/>
                <apex:column value="{!a.probability}"/>
        </apex:pageBlockTable>
        
        
  
        </apex:pageblock>
</apex:form>
</apex:page>


i am able to retriev whether the check box selected or not but not able to get it's value dynamically. i have hadcoded the stagename in SOQL and hence it's working based on selection of check box.. i need to have stagename dynamically based of selection of check box
public class ContactClass {
@AuraEnabled
    public static list<contact> getCon(){
        list<contact> con =[select id,firstname,lastname,phone,email from contact ];
        return con;
    }
}
component:
<aura:component controller='ContactClass' implements='force:appHostable'>
    <aura:attribute name='myContact' type='object'/>
    <aura:attribute name='myColumn' type='list'/>
    <aura:handler name='init' value='{!this}' action='{!c.doit}'/>
    <p>Dynamically created Table</p>
    <lightning:button label='Viewdatatable' variant='inverse' onclick='{!c.done}'/>
    {!v.body}
</aura:component>
 
controller:

({
    doit : function(component, event, helper) {
        component.set('v.myColumn',[
            {label:'FirstName',field:'FirstName',type:'text'},
            {label:'LastName',field:'LastName',type:'text'},
            {label:'Phone',field:'Phone',type:'phone'},
            {label:'Email',field:'Email',type:'email'}
        ]);
       var c= component.get('c.getCon');
        c.setCallback(this,function(response){
            var state= response.getState();
            alert(state);
            if(state=='SUCCESS'){
                var result = response.getReturnValue();
                component.set('v.myContact',result);
            }else{
                alert('error');
            }
        });
        $A.enqueueAction(c);
    },
    getSelect:function(component,event,helper){
        var select= event.getParam('selectedRows');
        alert(select);
    },
    done:function(component,event,helper){
         $A.createComponent('lightning:datatable',
                           {
                               'keyField':'Id',
                               'columns':component.get('v.myColumn'),
                               'data':component.get('v.myContact'),
                               'maxRowSelection':'3',
                               'onrowselection':component.getReference('c.getSelect')
                           },
                           function(comp,status,errorMessage){
                               if(status=='SUCCESS'){
                                   alert('this'+status);
                                   var bdy = component.get('v.body');
                                   bdy.push(comp);
                                   component.set('v.body',bdy);
                               }else if(status=='INCOMPLETE'){
                                   alert('incomplete');
                               }else if(status=='ERROR')
                                   alert(errorMessage);
                           }
                           
        );
    }
})
 
We are running into the following exception after updating a record in our org that fires a workflow: 
We can't save this record because the “Account: IAL Email Changes” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: ContactTrigger: execution of AfterUpdate caused by: System.RequiredFeatureMissingException: Field 'ProfilePhotoId' on object 'User' is not supported. One or more features must be enabled to access this field. () . You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 1216016854-20514 (-1794866724)

We are unable to find any documentation about this ProfilePhotoId field or how to enable it. We are also unsure why this is even happening because we can't find anything in the org that is referencing this field.

Has anyone else encountered this?
I have a FormAssembly form to register applicants for a program. On the form they upload their profile picture. That loads to Google Docs, Notes, & Attachments just fine. What I am trying to do is either add the image to a rich text field automatically or include a link to the image in a report. So far in researching this I have not found any solution. I'm wondering if either or both of these scenarios are even possible and if so how could it be accomplished if it can. 
Hi All,

I am no developer. I have this test class in sandbox. I tried to deploy it to production and I am hitting a code coverage error(Code Coverage Failure. Your code coverage is 0%. You need at least 75% coverage to complete this deployment.
PBBRunAssignmentRules)


. see the class here:

// Digital Pi - This Apex class is used to reassign a lead using standard assignment rules
public with sharing class PBBRunAssignmentRules {
@InvocableMethod(label='Re-run Assignment Rules on Lead')
public static void ReRunAssignmentRules(list<string> recordIds) {

set<id> LeadIds = new set<id>();

for (string recordId:recordIds){
id rid=id.valueOf(recordId);
Schema.SObjectType sot= rid.getSObjectType();
if (sot == Lead.sObjectType){
LeadIds.add(rid);
}
}

if (!LeadIds.isempty()){
//ID jobID = System.enqueueJob(new PBBLeadReassignQueueable(LeadIds));
if (system.isFuture()) {
system.debug('running in future already; exiting!');
return;
} else {
system.debug('starting future call');
futureLeadReassign(LeadIds);
}
}
}

@future
public static void futureLeadReassign(Set<ID> ReassignSet) {

system.debug('in the future, doing lead reassignment');
List<Lead> UpdList = [SELECT Id FROM Lead WHERE Id IN: ReassignSet];

for (Lead l:UpdList) {
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
// use leadAssignment rules when updating
l.setOptions(dmo);
}
system.debug(UpdList);
update(UpdList);
}
}


What do I need to do? Do I need a trigger or test class?  Any help with writing this test class please?
  • January 02, 2019
  • Like
  • 0
I'm trying to learn how to write a trigger that calls a class. When trying to deploy I'm getting this error "Trigger does not exist: Trigger"
Here's my Trigger:
trigger MasterOnboardingTrigger on Onboarding__c (
    before insert, after insert, 
    before update, after update, 
    before delete, after delete) {

    if (Trigger.isBefore) {
        if (Trigger.isInsert) {
        // Call class logic here!
        } 
        if (Trigger.isUpdate) {
        // Call class logic here!
        FulfillmentFirst ful = new FulfillmentFirst(Trigger.new);
        }
        if (Trigger.isDelete) {
        // Call class logic here!
        }
    }

    if (Trigger.IsAfter) {
        if (Trigger.isInsert) {
        // Call class logic here!
        } 
        if (Trigger.isUpdate) {
        // Call class logic here!
        }
        if (Trigger.isDelete) {
        // Call class logic here!
        }
    }
}
And here's my class:
public class FulfillmentFirst {
    // This will hold the onboarding record passed by the trigger
    List<Onboarding__c> onbs; 
    

    public FulfillmentFirst (List<Onboarding__c> triggerOnb) {
        onbs  = triggerOnb;
    }

    public void CreateFirstFulfillment(){
        for(Onboarding__c onb : onbs){
            if(onb.Fulfillment_Created__c = false){
                // Engage
                if(onb.Product__c == 'Engage'){
                    Fulfillment__c enFul = new Fulfillment__c();
                    enFul.Name                   = 'Engage First Fulfillment + ' + onb.Account__r.Name;
                    enFul.Status__c            = 'Not Started';
                    enFul.Account__c       = onb.Account__c;
                    enFul.Due_Date__c    = Date.today().addDays(14);
                    enFul.RecordTypeId  = '0121I000000G1dkQAC';
                    insert enFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }

                // Social Ads
                if(onb.Product__c == 'Social Ads'){
                    Fulfillment__c saFul = new Fulfillment__c();
                    saFul.Name                   = 'Social Ads First Fulfillment + ' + onb.Account__r.Name;
                    saFul.Status__c            = 'Not Started';
                    saFul.Account__c       = onb.Account__c;
                    saFul.Due_Date__c   = Date.today().addDays(14);
                    saFul.RecordTypeId = '0121I000000G1dmQAC';
                    insert saFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }

                // Social Posting
                if(onb.Product__c == 'Social Posting'){
                    Fulfillment__c spFul = new Fulfillment__c();
                    spFul.Name                   = 'Social Posting First Fulfillment + ' + onb.Account__r.Name;
                    spFul.Status__c            = 'Not Started';
                    spFul.Account__c       = onb.Account__c;
                    spFul.Due_Date__c   = Date.today().addDays(14);
                    spFul.RecordTypeId = '0121I000000G1doQAC';
                    insert spFul;
                    onb.Fulfillment_Created__c = true;
                    update onb;
                }
            }
        }
    }
}
Any help would be much appreciated.
I have a visualforce page but when I moved to lightning experience automatic a horizontal scroll bar is adding to this page which is a embedded in lightning record page.
User-added image
So here I am trying to remove this scroll bar by overriding the CSS but its not working
User-added image
In the above image I want to disable the overflow so that its removing the scroll bar 
User-added image
after removing the overflow in browser inspect it seems to be perfect. but here I need to override this into my page.
My code
<apex:page standardController="Account">
<style>
   oneAlohaPage .conten {
   overflow: hidden;
}
</style>
<div id="InnternalDiv" style="height: 2000px; width: 500px;">
    <apex:Form>
            <apex:pageBlock>
                <apex:pageBlockSection columns="2">
                    <apex:outputLabel value="First one " />
                    <apex:outputLink target="_blank"
                        value="https://www.google.com/maps/d/viewer?mid=1b6zZey5tKiiv6UP3O5xac1AN8I0">https://www.google.com/maps/d/viewer?mid=1b6zZey5tKiiv6UP3O5xac1AN8I0 </apex:outputLink>
                    <apex:outputLabel value="First two " />
                    <apex:outputLink target="_blank"
                        value="https://www.google.com/maps/d/viewer?mid=1kNPIg_2jXtCNRsN_7VcEtrhDUfI">https://www.google.com/maps/d/viewer?mid=1kNPIg_2jXtCNRsN_7VcEtrhDUfI </apex:outputLink>
                </apex:pageBlockSection>
            </apex:pageBlock>           
    </apex:Form>
</div>

 
<apex:page>

   <script>     
    function errorHandling()
    {
        alert('clicked save');
        alert(document.getElementById('{!$Component.fm:pb:sectionQty:pbsQ:dateQ}'));
        var validate=document.getElementById('{!$Component.fm:pb:sectionQty:pbsQ:dateQ}').value; 
        
        if(validate == '')
        {
            alert('please enter the Name');
            // return false;
        }    
        else
        {
           alert('else');
            save();
            
        }       
    }    
    </script>

    <apex:form rendered="{!!recordsTable}" id="fm" >      
        <apex:actionFunction name="save" action="{!save}"  />

        <apex:pageBlock rendered="{!!recordsTable}" id="pb">                    
            <div id="sectionQty">                
                <apex:pageBlockSection title="Establish Quantity Schedule" collapsible="false" columns="1" id="pbsQ" >
                    <apex:input label="Start Date" type="date" value="{!datefieldQty}" id="dateQ" /> 
                </apex:pageBlockSection>  
            </div>          
            
            <apex:pageBlockButtons location="bottom" >                 
                <apex:commandButton value="Save" onclick="errorHandling();return false;" />  
            </apex:pageBlockButtons>            
        </apex:pageBlock>          
    </apex:form>
  </apex:page>
Hello,

I need to pass some information from an e-commerce site to Salesforce. Salesforce already has a SOAP API where I can connect to send the data.

How can I know the actual API URL?

For example, one of those URL could be https://test.salesforce.com/services/Soap/c/37.0/0DF190000008OTI. That URL is active since when you place it in browser, server responds with an error telling that only POST request is allowed.

But that URL is not the endpoint of my API.

How can I know it? what is the "0DF190000008OTI" part?

Thanks
Jaime
Hi All,
I have developed a component for mass email sending .but i am getting an error like This page has an error. You might just need to refresh it. Aura.loadComponent(): Failed to initialize the application. An internal server error has occurred Error ID: 1863109829-477750 (412317498).
User-added image
<aura:component controller="ListEmailOppCntrlr" implements="force:hasRecordId,flexipage:availableForAllPageTypes,force:lightningQuickActionWithoutHeader" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.loadComponent}"/> 
    <aura:attribute name="errorMsg" type="String" description=""/>
    <aura:attribute name="shoMsg" type="boolean" default="false" description=""/>
    <aura:attribute name="shwSucesMsg" type="boolean" default="false" description=""/>
    <aura:attribute name="showLoader" type="boolean" default="false" description=""/> 
    <aura:attribute name="Case" type="Case" 
                    default="{ 'sobjectType': 'Case', 'SampleRichText__c':''}"/>
    
    <aura:attribute name="disableTemplate" type="boolean" default="false" description=""/>
    <aura:attribute name="selTempl" type="String" description=""/>
    <aura:attribute name="templates" type="EmailTemplate[]" default="[]"/>
    <aura:attribute name="addnlEmails" type="String" default="" description=""/>
    <aura:attribute name="subjTxt" type="String" default="" description=""/>
    <aura:attribute name="msgReview" type="String" default="" description=""/>
    <aura:attribute name="accIds" type="String" access="GLOBAL" default="" description=""/>
    <aura:attribute name="oppIds" type="String" access="GLOBAL" default="" description=""/>
    <aura:attribute name="accRecords" type="sObject[]" default="[]" />
    <aura:attribute name="templDetail" type="EmailTemplate" default="{}" />
    
    <div class="slds-page-header" role="banner">
        <div class="slds-grid">
            <div class="slds-col slds-has-flexi-truncate">
                <!-- SEARCH AREA -->
                <p class="slds-text-title--caps slds-line-height--reset">
                    
                    <span title="lead Standard Icon">
                        
                    </span>&nbsp;&nbsp;Send Email</p>
                <!-- / SEARCH AREA -->
            </div>
            
        </div>
    </div>
    
    
    
    <br/><br/>
    <!-- Connection 1 Section -->
    <div class="slds-grid slds-grid_vertical">
        <div class="slds-box slds-box--small slds-theme--shade slds-text-align--left">Email Message</div>
        <br/>
        <div class="slds-col">
            
            <div class="slds-form-element slds-size--1-of-1">
                <!-- <label class="slds-form-element__label" for="input-02">Recipients<span color="red"><b>*</b></span></label> -->
                
                <!--  <input type="Text" autocomplete="off" style="border-left:4px solid red;" value=""  class="slds-input" /> -->
                
                                <c:reUsableMultiSelectLookup objectAPIName="account"
                                             IconName="standard:account"
                                             lstSelectedRecords="{!v.accRecords}"
                                             label="Recipients" 
                                             />
                

            </div>
            
        </div> <br/><br/>
        
        <div class="slds-col">
            <lightning:select disabled="{!v.disableTemplate}" onchange="{!c.loadTemplate}"  name="SelectDivision" label="Select a Template:" aura:id="templateId" value="{!v.selTempl}">
                <option text="None" value=""/>
                
                <aura:iteration items="{!v.templates}" var="item">
                    <option text="{!item.Name}" value="{!item.Id}"/>
                </aura:iteration> 
            </lightning:select>
        </div> <br/><br/> 
        
        <div class="slds-col">
            <div class="slds-form-element slds-size--1-of-1">
                <label class="slds-form-element__label" for="input-02">Subject:</label>
                
                <input id="subjMatter" type="Text" autocomplete="off" value="{!v.subjTxt}"  class="slds-input" />
            </div>  
            
        </div><br/><br/>
        
        <div class="slds-col" aura:id="emailBodyDiv">   
            <div class="slds-form-element slds-size--1-of-1">
                <label class="slds-form-element__label" for="input-02">Content :</label>
                <span></span>
                <force:inputField class="richTxt" value="{!v.Opportunity.SampleRichText__c}"/>
            </div>
        </div><br/><br/>
        
        <aura:if isTrue="{!!empty(v.selTempl)}" >
            <lightning:textarea name="myTextArea" value="{!v.templDetail.Body}" 
                                label="Content:" maxlength="700" 
                                class="txtAreaCls" disabled="true" />
            <br/><br/>
        </aura:if>
        
        
    </div>    
    
    <br/>
    
    <!-- Error message area -->
    
    <br/><br/>
    <aura:if isTrue="{!v.shoMsg}" >
        <ui:message aura:id="errPanel"  title="Error" severity="error" closable="false">
            {!v.errorMsg}
        </ui:message>
        <br/><br/>
    </aura:if>
    
    <aura:if isTrue="{!v.shwSucesMsg}" >
        <ui:message aura:id="errPanel"  title="Success!" severity="confirm" closable="false">
            Email has been sent!
        </ui:message>
        <br/><br/>
    </aura:if>	
    
    <!-- Buttons and Loader section -->
    <div class="slds-align_absolute-center " style="padding:2%;">
        
        <lightning:button variant="brand" label="Send Email" onclick="{!c.sendEmailAction}" />
        
        <input type="button" value="Cancel" class="slds-button slds-button--neutral" onclick="{!c.closeDialog}"/>
        <aura:if isTrue="{!v.showLoader}">
            <div class="demo-only" style="height: 6rem;">
                <div role="status" class="slds-spinner_brand slds-spinner slds-spinner_small">
                    <span class="slds-assistive-text">Loading</span>
                    <div class="slds-spinner__dot-a"></div>
                    <div class="slds-spinner__dot-b"></div>
                </div>
            </div>
        </aura:if>  
        
    </div>     
</aura:component>
 
({
    
     loadComponent : function(component, event, helper) {
        helper.getSelctedAccountsOfOpportunity(component, event);
        helper.getEmailTempaltes(component, event);
        console.log(component.get("v.accIds"));
    }, 
   
    sendEmailAction : function(component, event, helper) {
        helper.sendEmails(component, event);
        
    },
    loadTemplate : function(component, event, helper) {
        helper.getTemplate(component, event);
        
    },
    closeDialog : function(component, event, helper)
    {
        helper.cancelAction(component, event);
    }
    
    
    
    
    
})
 
({
    getEmailTempaltes : function(component, event) {
        var action = component.get("c.getTemplates");
        //action.setParams({"divisionId":selectedDivision});
        
        action.setCallback(this,function(response){
            var loadResponse = response.getReturnValue();
            console.log('templates..!',loadResponse);
            
            if(!$A.util.isEmpty(loadResponse)){
                
                component.set('v.templates',loadResponse);
                
            }
        });
        $A.enqueueAction(action);
    },
    getSelctedAccountsOfOpportunity : function(component, event) {
        
        var accIdsofOpp = component.get("v.accIds");
        
        if(!$A.util.isEmpty(accIdsofOpp)){
            
            var action = component.get("c.getAccountsOfOpportunity");
            action.setParams({"accIds":accIdsofOpp});
            
            action.setCallback(this,function(response){
                var responseVal = response.getReturnValue();
                console.log('responseVal..** ',responseVal);
                
                if(!$A.util.isEmpty(responseVal)){
                    
                    component.set("v.accRecords",responseVal);
                    
                }
            });
            $A.enqueueAction(action);
        }
        
    },
    sendEmails : function(component, event) {
        component.set("v.shoMsg", false);
        component.set("v.showLoader", true);
        var selRec = component.find("lookupRes").get("v.lstSelectedRecords");
        var templateId = component.get("v.selTempl");
        var oppRecIds = component.get("v.oppIds");
        console.log('oppRecIds ', oppRecIds);
        console.log('sel records ', selRec);
        console.log('sel template ', templateId);
        
        //var addnlEmails = document.getElementById("addnlEmail").value;
        
        var subjMatter = document.getElementById("subjMatter").value;
        console.log('subjMatter ',subjMatter);
        var emailBody = !$A.util.isEmpty(component.get("v.Case").SampleRichText__c) ? component.get("v.Case").SampleRichText__c : '';
        console.log('emailBody ',emailBody);
        
        if(!$A.util.isEmpty(selRec) && (!$A.util.isEmpty(emailBody) || !$A.util.isEmpty(templateId)) ){
            
            var accIds = [];
            for (var i = 0; i<selRec.length; i++) {
                accIds.push(selRec[i].PersonContactId);
            }
            console.log('---accIds--- ', accIds);
            var accIdStr = !$A.util.isEmpty(accIds) ? accIds.join() : '';
            console.log('---accIdStr--- ', accIdStr);
            
            if(!$A.util.isEmpty(accIdStr) || !$A.util.isEmpty(addnlEmails)){
                
                console.log('---accIdStr--- ', accIdStr);
                console.log('--Case--', component.get("v.Case"));
                
                var action = component.get("c.sendAnEmailMsg");
                action.setParams({"templateId":templateId,
                                  "accIds":!$A.util.isEmpty(accIdStr) ? accIdStr : '',
                                  "opty":component.get("v.Case"),
                                  "subj" : !$A.util.isEmpty(subjMatter) ? subjMatter : '',
                                  "addnlEmails" : '',
                                  "oppIds" : oppRecIds });
                
                action.setCallback(this,function(response){
                    
                    var emailMsgResp = response.getReturnValue();
                    console.log('--emailMsgResp--', emailMsgResp); //isSuccess  errMsg
                    component.set("v.showLoader", false);
                    
                    if(emailMsgResp.isSuccess){
                        component.set("v.shwSucesMsg", true);
                        this.cancelAction(component, event);
                    }
                    else {
                        component.set("v.shoMsg", true);
                        component.set("v.errorMsg", emailMsgResp.errMsg);
                    }
                    
                });
                $A.enqueueAction(action);
            }
            
            
            
        }
        else {
            component.set("v.showLoader", false);
            component.set("v.shoMsg", true);
            component.set("v.errorMsg", "Please provide Recipient, Template or Email Body");
        }
        
    },
    getTemplate : function(component, event) {
        
        var templId = component.get("v.selTempl");
        component.set("v.showLoader", true);
        if(!$A.util.isEmpty(templId)){
            
            var action = component.get("c.getTemplateDetails");
            action.setParams({"templteId":templId});
            
            action.setCallback(this,function(response){
                component.set("v.showLoader", false);
                var responseVal = response.getReturnValue();
                console.log('responseVal..@getTemplate ',responseVal);
                
                if(!$A.util.isEmpty(responseVal)){
                    
                    component.set("v.templDetail",responseVal);
                    component.set("v.subjTxt",responseVal.Subject);
                    if(!$A.util.hasClass(component.find("emailBodyDiv"), "slds-hide")){
                        
                        $A.util.addClass(component.find("emailBodyDiv"), 'slds-hide'); 
                    }
                    
                }
            });
            $A.enqueueAction(action);
        }
        else {
            component.set("v.showLoader", false);
            if($A.util.hasClass(component.find("emailBodyDiv"), "slds-hide")){
                
                $A.util.removeClass(component.find("emailBodyDiv"), 'slds-hide');
            }
        }
    },
    cancelAction: function(component, event){
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": '/500/o'
        });
        urlEvent.fire()
    }
    
})

 
List of Apex Test Failures
So I've run into some issues that I've not seen before as I attempt to move an updated visualforce page and apex class out of the sandbox and into production. I'm not sure what the CTLR_VolunteerAppliationTest is referring to, so I'm not sure where to start to fix this problem. The second set of failures regarding System.DmlException: Insert failed. don't make sense as the class names listed: Paypal_Autherization and below aren't even included anywhere on the visualforce page or apex class I am attempting to move. Any pointers for a newbie to apex testing and visualforce development would be greatly appreciated.

For Reference Apex Class Code:

public with sharing class CTLR_VolunteerApplication_Updates {
    public final ApexPages.StandardController controller;
    public Account account { get; set;}
    
    public CTLR_VolunteerApplication_Updates(ApexPages.StandardController controller) {
        this.controller = controller;
        this.account = (Account)controller.getRecord();
        
    }
      
    public String salutation {get; set;}
    public String fname {get; set;}
    public String lname {get; set;}  
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerAvail = Schema.Account.GW_Volunteers__Volunteer_Availability__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerAvail.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Availability__pc !=null && this.account.GW_Volunteers__Volunteer_Availability__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Availability__pc = selectedCheckBox;
     }
   } 
    
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions2 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerInterests = Schema.Account.GW_Volunteers__Volunteer_Skills__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerInterests.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems2 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Skills__pc !=null && this.account.GW_Volunteers__Volunteer_Skills__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Skills__pc = selectedCheckBox;
     }
   } 
    
//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   } 
   
    public PageReference submit() {
      integer count = 0;
      count = [SELECT count() FROM Account WHERE FirstName = :account.FirstName AND LastName = :account.LastName ];
      System.debug('count' + count);
      
      if ( count == 0 )    {
      
          if (account.Terms_Conditions_Accepted__pc)  {
              try{
                    RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];
                    account.RecordType = personAccountRecordType;
                    account.Salutation = salutation;
                    account.FirstName = fname;
                    account.LastName = lname;
                    account.Contact_Email__c = account.PersonEmail;
                    account.Volunteer_Application_Submitted__c = true;
                    if ( [ SELECT count() FROM Account WHERE PersonEmail = :account.PersonEmail ] > 0 )
                      {
                       
                       Account a = [SELECT    Id,
                                              Salutation,
                                              FirstName,
                                              LastName,
                                              Contact_Email__c, 
                                              Volunteer_Application_Submitted__c,   
                                              PersonMailingStreet, 
                                              PersonMailingState,
                                              PersonMailingCity,
                                              PersonMailingPostalCode,
                                              PersonHomePhone,
                                              Phone,
                                              PersonEmail,
                                              Allergies_and_or_Restrictions__pc,
                                              How_did_you_hear_about_us__pc,
                                              Current_Occupation__pc,
                                              GW_Volunteers__Volunteer_Availability__pc,
                                              GW_Volunteers__Volunteer_Skills__pc,
                                              Special_Skills__c,
                                              Experience_Level_With_Cats__c,
                                              Experience_Level_with_Dogs__c,         
                                              Emergency_Contact_Name__pc,
                                              Emergency_Contact_Home_Phone__pc,
                                              Emergency_Contact_Work_Phone__pc,
                                              Emergency_Contact_Email__pc,
                                              Terms_Conditions_Accepted__pc,
                                              Age_Checkbox__c
                                           FROM Account
                                           WHERE PersonEmail = :account.PersonEmail OR Contact_Email__c = :account.PersonEmail LIMIT 1] ;
                       a.RecordType = personAccountRecordType;
                       a.Salutation = salutation;
                       a.FirstName = fname;
                       a.LastName = lname;
                       a.Contact_Email__c = account.PersonEmail;
                       a.PersonEmail = account.PersonEmail;
                       a.Volunteer_Application_Submitted__c = true;
                       a.PersonMailingStreet = account.PersonMailingStreet;
                       a.PersonMailingState  = account.PersonMailingState;
                       a.PersonMailingCity = account.PersonMailingCity;
                       a.PersonMailingPostalCode = account.PersonMailingPostalCode;
                       a.PersonHomePhone = account.PersonHomePhone;
                       a.Phone = account.Phone;
                       a.Allergies_and_or_Restrictions__pc = account.Allergies_and_or_Restrictions__pc;
                       a.How_did_you_hear_about_us__pc = account.How_did_you_hear_about_us__pc;
                       a.Current_Occupation__pc = account.Current_Occupation__pc;
                       a.GW_Volunteers__Volunteer_Availability__pc = account.GW_Volunteers__Volunteer_Availability__pc;
                       a.GW_Volunteers__Volunteer_Skills__pc = account.GW_Volunteers__Volunteer_Skills__pc;
                       a.Special_Skills__c = account.Special_Skills__c;
                       a.Experience_Level_With_Cats__c = account.Experience_Level_With_Cats__c;
                       a.Experience_Level_with_Dogs__c = account.Experience_Level_with_Dogs__c;
                       a.Emergency_Contact_Name__pc = account.Emergency_Contact_Name__pc;
                       a.Emergency_Contact_Home_Phone__pc = account.Emergency_Contact_Home_Phone__pc;
                       a.Emergency_Contact_Work_Phone__pc = account.Emergency_Contact_Work_Phone__pc;
                       a.Emergency_Contact_Email__pc = account.Emergency_Contact_Email__pc;
                       a.Terms_Conditions_Accepted__pc = account.Terms_Conditions_Accepted__pc;
                       a.Age_Checkbox__c = account.Age_Checkbox__c;
                       upsert a;
                      }
                    else
                       insert account;
                }        
            catch(Exception e){
                ApexPages.addMessages(e);
                return null;
            
                }
          PageReference pageRef = new PageReference('http://www.pawsatlanta.org/thank-you-for-saving-a-life');
          pageRef.setRedirect(true);
          return pageRef; 
  
          }
         Else {
             account.Terms_Conditions_Accepted__pc.addError('Please Accept Terms and Conditions');
             return null;
         }
     }
     Else {
     
            ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'Person Account Already Exists');
            ApexPages.addMessage(message);
            return null;
     
     }
     
    
   }

 
    public String pawsLogo { get {
        document doc = [ SELECT Id, Name FROM Document WHERE Name = 'PAWS Logo' limit 1];
        string imageid = doc.id; 
        imageid = imageid.substring(0,15);
        return '/servlet/servlet.FileDownload?file=' + imageid;
        }  set; }
    
    
}

 
Hi,

 I am writing a test class I am not able to proceed further in the calculation part in class need you suggestion how to cover. 
 
public class CpqQuoteLineTriggerUtils {

    public static void calcMarigns(List<SBQQ__QuoteLine__c> newLst) {
        Set<Id> product2IDs = new Set<Id>();
        Set<String> bundleSkus = new Set<String>();
        ID pbId = null;
        Map<String, String> bundleSkuMap = new Map<String, String>();
        Map<String, PriceBookEntry> pbeMap = new Map<String, PriceBookEntry>();
        system.debug(newLst);

        for (SBQQ__QuoteLine__c line : newLst) {
            if(pbId == null) {
                pbId = [select SBQQ__PriceBook__c from SBQQ__Quote__c where id = :line.SBQQ__Quote__c].SBQQ__PriceBook__c;
            }
            if(line.CPQ_IS_Dummy_Product_Formula__c == false) {
                product2IDs.add(line.SBQQ__Product__c);
                if(line.CPQ_Product_Code__c != null && line.CPQ_Product_Code__c.contains('-BDL')) {
                    bundleSkus.add(line.CPQ_Product_Code__c);
                }
            }
        }

        for(Bundled_Product_Map__c pmap: [SELECT Id, Bundle_SKU__c, Hardware_OR_Software_SKU__c 
                                                FROM Bundled_Product_Map__c where Bundle_SKU__c in :bundleSkus]) {
            system.debug('pmap.Hardware_OR_Software_SKU__c' + pmap.Hardware_OR_Software_SKU__c);
            system.debug('pmap.Bundle_SKU__c' + pmap.Bundle_SKU__c);                                     
            bundleSkuMap.put(pmap.Bundle_SKU__c, pmap.Hardware_OR_Software_SKU__c); 
        }

        for(PriceBookEntry pbe : [Select id, Product2.COGS__c,Product2.Product_Type__c,Product2.Productcode, UnitPrice,
                                        Product2.Isactive,Product2.CPQ_IS_Dummy_Product__c 
                                    from PriceBookEntry 
                                    where pricebook2.IsStandard = false 
                                        and (Product2Id In :product2IDs or Product2.ProductCode in :bundleSkuMap.values())
                                        and pricebook2ID = :pbId]) {
            pbeMap.put(pbe.Product2.ProductCode, pbe);
            system.debug( pbe.Product2.Isactive + 'cogs== '+ pbe.Product2.COGS__c+  'pbe' + pbe);
        }
        system.debug('pbeMap' + pbeMap);
        for (SBQQ__QuoteLine__c line : newLst) {
            System.debug('line '+ line);
            PriceBookEntry pbe = pbeMap.get(line.CPQ_Product_Code__c);
            if(line.CPQ_IS_Dummy_Product_Formula__c != true && pbe != null) {
                system.debug( 'cogs== '+ pbe.Product2.COGS__c+  'pbe' + pbe);
                system.debug('quoteline'+line);

                Double cogs = pbe.Product2.COGS__c;
                Double listPrice = line.SBQQ__ListPrice__c != null ? line.SBQQ__ListPrice__c : pbe.UnitPrice;
                if(line.CPQ_Product_Code__c.contains('COTERM')) {
                    cogs = listPrice * 0.1;
                }
                Double distiDiscount = ( 1 - (line.CPQ_DistDiscount__c == null ? 0 : line.CPQ_DistDiscount__c) /100);
                Double distiNetUnitPrice = listPrice * distiDiscount;
                Double quantity = line.SBQQ__Quantity__c;
                System.debug('quantity=' + quantity + 'cogs=' + cogs);
                Double grossMargin = (distiNetUnitPrice - cogs) * quantity;

                line.COGS__c = cogs;
                //line.Gross_Margin__c = grossMargin;
                system.debug( 'distiNetUnitPrice=' + distiNetUnitPrice + 'distiDiscount=' + distiDiscount + 'pbe' + pbe);

                Double totalBilling = distiNetUnitPrice * quantity;
                Double cogsBilling = cogs * quantity;
                line.Is_BundleMapping_missing__c = false;
                line.Bundle_Related_HW_Product__c = null;
                if(line.CPQ_Product_Code__c.contains('-BDL') ) {
                     if(bundleSkuMap.containsKey(line.CPQ_Product_Code__c)){
                        String mappingSku = bundleSkuMap.get(line.CPQ_Product_Code__c);
                         system.debug('mappingSku ' + mappingSku); 
                        PriceBookEntry hwProduct = pbeMap.get(mappingSku);
                         system.debug('hwProduct ' + hwProduct );
                         system.debug('hwProduct.Product2.cogs__c' + hwProduct.Product2.cogs__c);
                        cogsBilling = hwProduct.Product2.cogs__c * quantity;
                        Double hwListPice = hwProduct.UnitPrice;                
                        Double hwCogs = hwProduct.Product2.cogs__c;
                        Double hwSalesPrice = (hwListPice * distiDiscount);
                        Double hardwareBilling = hwListPice * distiDiscount * quantity;
                        system.debug('hwListPice =' + hwListPice + ' hwSalesPrice =' + hwSalesPrice );
                        if(hwProduct.Product2.product_Type__c == 'HW' || hwProduct.Product2.product_Type__c == 'Hardware') {
                            line.Bundle_Related_HW_Product__c = hwProduct.Product2Id;
                            line.Hardware_billings_in_amount__c = hardwareBilling;
                            line.Hardware_Gross_Margin_in_amount__c = (hwSalesPrice - hwCogs)* quantity;
                            line.Hardware_Gross_Margin_Percentage__c = 100*(hardwareBilling -cogsBilling )/hardwareBilling; 
                        } 
                    } else {
                        line.Is_BundleMapping_missing__c = true;
                        system.debug( '_log_' + line);
                        //throw new PP_HandleException (p.ProductCode +  ' - this bundle product has not mapped with appropriate Hardware sku mapping, please contain admin with screenshot.' );
                    }
                } else if(pbe.Product2.product_Type__c == 'HW' || pbe.Product2.product_Type__c == 'Hardware') {
                    line.Hardware_billings_in_amount__c = totalBilling;
                    line.Hardware_Gross_Margin_in_amount__c = grossMargin;
                    line.Hardware_Gross_Margin_Percentage__c = 100*(totalBilling -cogsBilling )/totalBilling;
                } else if(pbe.Product2.Product_type__c == 'SW') {
                    line.Software_Billings_in_amount__c = totalBilling;
                } 
            }
        }
    }
    public static void processQuoteMatrics(List<SBQQ__QuoteLine__c> newLst) {
        Set<ID> qIds = new Set<ID> ();
        for(SBQQ__QuoteLine__c ql : newLst) {
            qIds.add(ql.SBQQ__Quote__c);
        }
         system.debug('Quote ID  ' + qIds);
        List<Quote_Category_Metrics__c> insertMatrics = new List<Quote_Category_Metrics__c>();
        for(AggregateResult result : [select Category__c,SBQQ__Quote__c, sum(CPQ_marginDollars__c) a, 
                                            sum(SBQQ__ListTotal__c) b, sum(SBQQ__NetTotal__c) c 
                                        from SBQQ__QuoteLine__c 
                                        where SBQQ__Quote__c  IN :qids and SBQQ__Quote__r.ApprovalStatus__c != 'Approved'  group by Category__c, SBQQ__Quote__c] ) {
            Quote_Category_Metrics__c qc = new Quote_Category_Metrics__c();
            system.debug('Category C ' + (String)result.get('Category__c'));
            system.debug('Category A  ' + (Decimal)result.get('a'));
            system.debug('Category B  ' + (Decimal)result.get('b') );
            system.debug('Category C  ' + (Decimal)result.get('c') );
            qc.Name = (String)result.get('Category__c');
            if(qc.name != null) {
                qc.CPQ_Gross_Margin__c = (Decimal)result.get('a');
                qc.CPQ_List_Price__c = (Decimal)result.get('b');
                qc.CPQ_Disti_Price__c = (Decimal)result.get('c');
                
                qc.CPQ_Quote__c = (String)result.get('SBQQ__Quote__c');
                insertMatrics.add(qc);
            }
        }

        List<Quote_Category_Metrics__c> existingRec = [select id from Quote_Category_Metrics__c where CPQ_Quote__c in :qIds];
        if(!existingRec.isEmpty()) {
            delete existingRec;
        }

        if(!insertMatrics.isEmpty()){
            insert insertMatrics;
        }
    }


}
Below lines are not getting covered. 
User-added image
Test Class
@isTest(seealldata=true)
public class CpqQuoteLineTriggerUtilsTest
{  
    public static testMethod void method1(){
        
       list<SBQQ__QuoteLine__c> SBQQlst = new list<SBQQ__QuoteLine__c>();
       
        
        Profile profileObj =[select id from Profile where name='System Administrator' limit 1];
        User u = new User(
            FirstName = 'Sudhir',
            LastName = 'Testing Usre',
            Alias = 'tstN',
            Email = 'test11@abc.com',
            Username = 'partne1r11@abc.com',
            CommunityNickname = 'testi11',
            emailencodingkey = 'UTF-8',
            languagelocalekey = 'en_US',
            localesidkey = 'en_US',
            timezonesidkey = 'America/Los_Angeles',
            profileId = profileObj.Id,
            spr_region__c = 'LATAM',
            NFR_User__c  = false,
            SPR_to_Forticare_Linking__c = true
        );
        insert u; 
        
        Distributor__c Dist = [select id from Distributor__c where CPQ_DistributorStatus__c  = true limit 1];
        
        Account Pact = [select id from account where recordtype.name = '.Partner' and Is_In_RV_Portal__c = true and Partner_Status__c = 'Activated' limit 1];
        
        Contact Pcnt = [select id from contact where accountid = :Pact.id  limit 1];    
        
        Account Act = new Account( Name = 'Test Sudhir Ac',Website='www.sudhir.com',Industry='Legal',BillingStreet='894', BillingCity='sunnyvalley', BillingState='CA', 
                                  BillingPostalCode='997',BillingCountry='United States',Customer_Status__c='Current Customer');  
        
        insert Act; 
        
        Contact C = [select id from contact limit 1];
        
        Opportunity opp = new Opportunity(
            AccountId=Act.id,
            StageName='Omit from Forecast',
            Amount = 0,
            Name = 'Test Sudhir',
            CloseDate = Date.today(),
            Market_Segmentation__c = 'Education',
            End_User_Industry__c = 'Education',
            End_Customer_Country__c = 'United States',
            Deal_Type__c='Refresh',
            Primary_Opportunity_Contact__c =  c.id
        );
        
        insert opp;
        
        OpportunityTeamMember oppmem = new OpportunityTeamMember(
            Opportunityid = opp.id,
            OpportunityAccessLevel = 'Read' ,
            TeamMemberRole = 'CAM',
            Userid = u.id ); 
        
        insert oppmem;
        
        SBQQ__Quote__c SQ = new SBQQ__Quote__c(SBQQ__Opportunity2__c = opp.id,
                                               CPQ_Distributor__c = Dist.id,
                                               CPQ_Partner_Account__c = Pact.id,
                                               CPQ_Partner_Contact__c = Pcnt.id
                                              );
        
        
        insert SQ;
        
        
        PricebookEntry pbe = [ select   Id, IsActive, Name, Pricebook2Id, Product2Id, ProductCode, SystemModstamp, UnitPrice, UseStandardPrice 
                              from PricebookEntry where isactive = true and usestandardprice = true limit 1];
        
        Product2 Prd = [select id from product2 where isactive = true and COGS__c <> null limit 1];
        
        Product2 PrdCTRM = [select id from product2 where isactive = true and productcode = 'COTERM' and COGS__c <> null limit 1];
        
        SBQQ__QuoteLine__c SQln = new SBQQ__QuoteLine__c(SBQQ__Product__c = Prd.id,
                                                         SBQQ__Quantity__c = 1,
                                                         SBQQ__Quote__c = SQ.id,
                                                         SBQQ__ListPrice__c = 111,
                                                         SBQQ__NetPrice__c = 111,
                                                         CPQ_Reseller_Discount__c = 22,
                                                         Category__c = 'A'
                                                        );
        insert SQln;                                                                                                    
        
        SBQQ__QuoteLine__c SQlnCTRM = new SBQQ__QuoteLine__c(SBQQ__Product__c = PrdCTRM.id, 
                                                             SBQQ__Quantity__c = 1,
                                                             SBQQ__Quote__c = SQ.id,
                                                             SBQQ__ListPrice__c = 111,
                                                             SBQQ__NetPrice__c = 111,
                                                             CPQ_Reseller_Discount__c = 22,
                                                             CPQ_Forticare_Quote_ID__c = 'SUDHIR',
                                                             Category__c = 'B'
                                                            );
        insert SQlnCTRM;                                                                                                    
        
        SBQQlst.add(SQlnCTRM);
        
        SBQQ__Quote__share SQS = new SBQQ__Quote__share(UserOrGroupId = u.id,
                                                        ParentId = SQ.id,
                                                        AccessLevel  = oppmem.OpportunityAccessLevel
                                                       );
        
        insert SQS;
        
        Quote_Category_Metrics__c QCM = new Quote_Category_Metrics__c(Name='a', CPQ_Quote__c=SQ.id,CPQ_Gross_Margin__c = 1,CPQ_List_Price__c =1,CPQ_Disti_Price__c =1);    
        
        insert QCM;
        
         Test.startTest();

          CpqQuoteLineTriggerUtils.calcMarigns(SBQQlst);
     
         Test.stopTest();
 
    }
    
    
    public static testMethod void method2(){
        
        SBQQ__Quote__c  quote = [ select  id, NAme,CPQ_Distributor__c, SBQQ__PriceBook__c, Deal_Type__c, Quote_Has_CSPP_Partner_Account__c,
                                 CPQ_Distributor__r.Account__r.BillingCountry,CPQ_Distributor__r.Account__c,
                                 (select SBQQ__Product__c, CPQ_Quote_Line_Item_Type__c, SBQQ__Quote__c,Category__c,SBQQ__Quantity__c,
                                  SBQQ__ListPrice__c, CPQ_DistDiscount__c, SBQQ__CustomerPrice__c, SBQQ__NetPrice__c,CPQ_Forticare_Quote_ID__c,
                                  CPQ_DISTDiscOverride__c, CPQ_ResellerDiscOverride__c,CPQ_Reseller_Discount__c
                                  from SBQQ__LineItems__r)
                                 from SBQQ__Quote__c limit 1 ];
        
        Quote_Category_Metrics__c QCM = [select id from Quote_Category_Metrics__c where CPQ_Quote__c = :quote.id limit 1]; 
        
        delete qcm;
        
    }  
    
   
    
    
}

Thanks
Sudhir​​​​​​​
I am working on a challenge on my Trailhead Playground, and when I click the verify step on the work done I get an error: 
The first time I tried to verify the challenge I got this error:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: IBIDSYLA
The second time I tried to verify the challenge I got a different error:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: RJXDRZMP

Your he;p will be much appreciated!

~Linda


 
Hello All,
We are displaying report through detail page links on our custom objects. But the issue is when I install this as a package, in the target org the report is not getting displayed because report ID gets changed from org to org.Moreover I am not able to edit this detail page link as it is a managed pacakge componenet. So any suggestion for this or any alternative for this. Your help will be really appreacated.
I am very new to writing apex code and have come to a roadblock when it comes to moving the updated Visualforce page I've helped edit out of the sandbox and into production. When I created the changeset I added the visual force page and associate apex class that I've been working in. When I went to validate this change set in production I got several component errors. Namely that a certain variable doesn't exist and that the apex class I thought I'd created didn't exist as well.

Below I've attached the code where several of the errors exist namely that the Variable: Special_Skills__c doesn't exist. I have done some trailheads and googled other questions to get to the point where the visualforce page created is exactly what we are looking for. I just need some help in overcoming these errors so that I can get this into production ASAP in addition to increasing my knowledge of code and working in a sandbox and ultimately transferring this information into production. Thanks in advance!

//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   }