• Sri549
  • SMARTIE
  • 534 Points
  • Member since 2013

  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 114
    Replies
Hii Friends

I am not familiar  at writing test clas i got arequirement
so please kindly  help me in writing this test class

this  is my class



global with sharing class EFAjaxRemotingFunctionsController
{
public EFAjaxRemotingFunctionsController(){}
public EFAjaxRemotingFunctionsController(ApexPages.StandardController controller){

    }

/* Object used to populate reference to user */
public EF_Request__c EFRequest
{
get;
set;
}

@RemoteAction
global static String getUserData(String recordId)
{
List<User> user = [select FirstName, LastName, Title, CompanyName from User where Id = : recordId];
// These methods are for serializing  Apex objects into JSON format available since Winter’12 release

String JSONString = JSON.serialize(user);
//Depends on your needs and way you want to format your result. Lets just hardcode the status value for now.
return '{"data":' +JSONString+', "error": "null", "status":"SUCCESS"}';
}
}
Thanks in Advance I am so kind of u
  • March 13, 2014
  • Like
  • 0
Hi. I am new to sales force. I have to perform a simple task.
When clicking an apex command button , it should alert a message through JavaScript.
Please see my code.

<apex:page standardController="Book__c">
<script>
    alertSample(){
        alert("Hello");
    }
</script>
    <apex:form >
        <apex:commandButton oclick="alertSample()" value="Hello"/>
        <apex:PageBlock title="Book View">
            <apex:outputField value="{! Book__c.Name}"/>
            <apex:detail />
        </apex:PageBlock>
    </apex:form>
</apex:page>

But I am not getting expected response. Please help.
Hey there, I have this trigger which is designed to rollup a number field into either one field or another based on certain criteria...However it must be phrased wrong or something as it is not saving. Please help. Thank you in advance



trigger FinanceCommissionEntry on Finance_Commission__c (after delete, after insert, after update) {

  //Limit the size of list by using Sets which do not contain duplicate elements
  set<id> OffComIds = new set<id>();

  //When adding new payments or updating existing payments
  if(trigger.isInsert || trigger.isUpdate){
    for(Finance_Commission__c FinCom : trigger.new){
      OffComIds.add(FinCom.Office_Commission__c);
    }
  }

  //When deleting Finance
  if(trigger.isDelete){
    for(Finance_Commission__c FinCom : trigger.old){
      OffComIds.add(FinCom.Office_Commission__c);
    }
  }

  //Map will contain one Opportunity Id to one sum value
  map<id,double>OffComMap = new map <id,double>();

  //Produce a sum of Payments__c and add them to the map
  //use group by to have a single Opportunity Id with a single sum value
  for(AggregateResult q : [select Office_Commission__c,sum(Finance_Commission_Amount__c),Finance_Commission_Institution__c
    from Finance_Commission__c where Office_Commission__c IN :OffComIds group by Office_Commission__c,Finance_Commission_Institution__c]){
      OffComMap.put((Id)q.get('Office_Commission__c'),(Double)q.get('expr0'));
  }

  List<Office_Commission__c> OffComToUpdate = new List<Office_Commission__c>();

  //Run the for loop on Opportunity using the non-duplicate set of Opportunities Ids
  //Get the sum value from the map and create a list of Opportunities to update


for(Office_Commission__c o : [Select Id, St_George_Upfront_Commission__c, DMS_Upfront_Commission__c from Office_Commission__c where Id IN :OffComIds]){
    Double PaymentSum = OffComMap.get(o.Id);



if (Finance_commission__c.Finance_Commission_Institution__c = 'St George') {


    o.St_George_Upfront_Commission__c = PaymentSum;
    OffComToUpdate.add(o);
   
    }else if (Finance_Commission__c.Finance_Commission_Institution__c = 'DMS') {


    o.DMS_Upfront_Commission__c = PaymentSum;
    OffComToUpdate.add(o);


  }

  update OffComToUpdate;
}
}
Hi am new to this technology please anyone help me how can I get good practise on triggers where in realtime I have to work with triggers.....
Hi All,


I have a Requirement for doing clone functionality .

Scenario: I have a picklist for Choose Awards   then the user selecting  one award  from the list this award has set of Qns and Ans .Here  user has to clicking on clone Button then he give input name of the Award then this set of qns & ans  insert into this award. How to implement this scenario?give some Examples pls....


Thanks
For the life of me I can't seem to get this working. I've written a custom extension class and a basic visualforce page to display a chart. As a normal controller with a hardcoded Account Id it works fine and the chart displays. When I try and convert it into a controller extension and add it to an account page I keep getting 'Content cannot be displayed: Attempt to de-reference a null object' errors.

Visualforce Page
<apex:page standardController="Account" extensions="BudgetController2"> 
  <apex:pageBlock title="Budget Test"> 
 
    <apex:chart height="400" width="500" data="{!ChartData}">
          <apex:legend position="right"/>
          <apex:axis type="Numeric" position="left" fields="data1,data2"
                 title="Value" grid="true"/>
          <apex:axis type="Category" position="bottom" fields="name"
                 title="Month"/>
          <apex:barSeries orientation="vertical" axis="left"
                 xField="name" yField="data1" title="Budget"/>
          <apex:lineSeries axis="left" xField="name" yField="data2"
                 markerType="circle" markerSize="4" markerFill="#8E35EF" title="Targett"/>
    </apex:chart>

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

Custom Controller Extension
public with sharing class BudgetController2 {

    private Account acct;

    public BudgetController2(ApexPages.StandardController controller) {

        acct = (Account)controller.getRecord();

    }

    public list<AggregateResult> lstBud = [SELECT SUM(Jan__c)Jan, SUM(Feb__c)Feb, SUM(Mar__c)Mar FROM Account WHERE Id = :acct.id];
    public list<AggregateResult> lstTar = [SELECT SUM(Jan_target__c)Jan, SUM(Feb_target__c)Feb, SUM(Mar_target__c)Mar FROM Account WHERE Id = :acct.id];
    public list<list<AggregateResult>> lstAll = new list<list<AggregateResult>>{lstBud, lstTar};
   
    public List<Data> getChartData() {
        List<Data> data = new List<Data>();
        data.add(new Data('Jan', (decimal)lstAll[0][0].get('Jan'), (decimal)lstAll[1][0].get('Jan')));
        data.add(new Data('Feb', (decimal)lstAll[0][0].get('Feb'), (decimal)lstAll[1][0].get('Feb')));
        data.add(new Data('Mar', (decimal)lstAll[0][0].get('Mar'), (decimal)lstAll[1][0].get('Mar')));
        system.debug(data);
        return data;
    }   

    public class Data {
        public String name { get; set; }
        public Decimal data1 { get; set; }
        public Decimal data2 { get; set; }
        public Data(String name, Decimal data1, Decimal data2) {
            this.name = name;
            this.data1 = data1;
            this.data2 = data2;

        }
    }
   

}


The debug logs show that the code stops as soo as it trys to run the constructor. I've tried pretty much every code combination I can find online, although i'm pretty sure it will be a glaringly obvious error!

Any help appreciated.


Hi Team,

I have the following trigger:

trigger UpdateHoursinCase on Case(after insert, after update)

{
  Map<ID, Contract> parentCont= new Map<ID, Contract>();
  List<Id> listIds = new List<Id>();

  for (Case childObj : Trigger.new) {
    listIds.add(childObj.Contract__c);
  }

  parentCont= new Map<Id, Contract>([SELECT id, Hours__c FROM Contract WHERE ID IN :listIds]);

  for (Case Cas: Trigger.new){
     Contract myParentCont = parentCont.get(Cas.Contract__c);
     myParentCont.Hours__c +=   Cas.HoursofWork__c;
  }

  update parentCont.values();
}

which counts hours from the "Child" Case to the Parent Contract.
I works fine.
The Class is:

@istest
public class UpdateLocationStatusonLocationClass{
    Private Static testmethod void TesttrgOnArticulo(){
        Test.startTest();
        Contract  CONT = new Contract ();

        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
//        CONT.AccountId = '001L000000KmBfF';
       
        CONT.CustomerSignedId = '003D0000017D7y8';
//        CONT.CustomerSignedId = '003L000000HQ131';
       
        CONT.Status = 'Draft';   
        String datea = '2000-11-01';
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
      
        insert CONT;
        List<Case>Lstcas=new List<Case>();
        for(integer i=0; i<5; i++){
       
            Case CAS = new Case();
            CAS.Contract__c = CONT.id;
            CAS.Location__c = 'Remote';           
            CAS.Charge__c = 'PER CALL';           
            CAS.AccountId = '001D0000010dW4H';
            CAS.ContactId = '003D0000017D7y8';           
            CONT.Status = 'Closed';
            CAS.Priority= 'EXECUTIVE';           

            Lstcas.add(CAS);
        }
        insert Lstcas;
       
        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
        CONT.CustomerSignedId = '003D0000017D7y8';
        CONT.Status = 'Draft';    
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
       
        update CONT;
       
        Test.stopTest();
    }
}

And it gets only 71% !
Any suggestions to add 4% ?
Best Regards,
Stefanos
how can i schedule this code yearly?
i want it to run every January 1 at 12am
global class autoCreateIS implements Schedulable {
         global void execute(SchedulableContext arc) {
                    Date dateToday = system.Today();
                    Integer year = dateToday.year();
                    Integer nextYear = (year + 1);
       
                    IS__c createIS = new IS__c();
                    createIS.Name = String.valueOf(nextYear);
                    insert createIS;
         }
}

when i go to Apex Classes > Schedule Apex, the only choices are weekly and monthly
what if i only want it to run yearly?
  • February 17, 2014
  • Like
  • 0

Hi,

 

I have a Custom controller class for my VF page. The controller class contains a page reference and in my page reference method, i have used methods of another custom controller. I have written a test class and it passed succesfully. But my code coverage was 48%. 

I have my controller class and test class below. Please help me..

 

Controller Class:

 


public with sharing class RecruiterPerformanceReport
{
// Gets the selected month from the page
public String getMonths { get; set; }

// Gets the selected year from the page
public String getYear { get; set; }

// Gets the selected report type from the page
public String getReportType { get; set; }

// Gets or sets the List of performance report.
public List<PerformanceReportClass> LstPerformanceReport {get;set;}

// Initializes a new instance of the RecruiterPerformanceReport class.
public RecruiterPerformanceReport()
{
}

 

// Gets the report details.
public PageReference GetReportDetails()
{
// Dispalys eror message
if(((Integer.valueOf(getReportType)) == 0) && ((Integer.valueOf(getYear)) == 0000) && ((Integer.valueOf(getMonths)) == 00))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Report type, Year & Month');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getReportType)) == 0) && ((Integer.valueOf(getYear)) == 0000))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Report type & Year');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getReportType)) == 0) && ((Integer.valueOf(getMonths)) == 00))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Report type & Month');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getYear)) == 0000) && ((Integer.valueOf(getMonths)) == 00))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Year & Month');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getReportType)) == 0))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Report Type');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getYear)) == 0))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Year');
apexpages.addmessage(msg);
return p;
}
else if(((Integer.valueOf(getMonths)) == 0))
{
pagereference p = apexpages.Currentpage();
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Please select Month');
apexpages.addmessage(msg);
return p;
}
else
{
// Selects the report type to be displayed based on selection
if((Integer.valueOf(getReportType)) == 1)
{
AssignRequirementReportClass objAssignRequirementReportClass = new AssignRequirementReportClass();
LstPerformanceReport = objAssignRequirementReportClass.getRequirementsAssigned(getMonths, getYear);
}
else if((Integer.valueOf(getReportType)) == 2)
{
ResumesSubmittedReportClass objResumesSubmittedReportClass = new ResumesSubmittedReportClass();
LstPerformanceReport = objResumesSubmittedReportClass.getResumesSubmitted(getMonths, getYear);
}
else if((Integer.valueOf(getReportType)) == 3)
{
ResumesRejectedReportClass objResumesRejectedReportClass = new ResumesRejectedReportClass();
LstPerformanceReport = objResumesRejectedReportClass.getResumesRejected(getMonths, getYear);
}
else if((Integer.valueOf(getReportType)) == 4)
{
CandidatesAddedReportClass objCandidatesAddedReportClass = new CandidatesAddedReportClass();
LstPerformanceReport = objCandidatesAddedReportClass.getCandidatesAdded(getMonths, getYear);
}
return null;
}
}
}

 

Test Class:


@istest (SeeAllData=true)
class TestClassRecruiterPerformanceReport
{
static testmethod void testRecruiterPerformanceReport()
{
PageReference pageRef = Page.Recruiter_Performance_Report;
Test.setCurrentPage(pageRef);

RecruiterPerformanceReport rrs = new RecruiterPerformanceReport();


rrs.getReportType = '1';
rrs.getMonths = '09';
rrs.getYear = '2013';
rrs.GetReportDetails();

rrs.getReportType = '2';
rrs.getMonths = '09';
rrs.getYear = '2013';
rrs.GetReportDetails();

rrs.getReportType = '3';
rrs.getMonths = '09';
rrs.getYear = '2013';
rrs.GetReportDetails();

rrs.getReportType = '4';
rrs.getMonths = '09';
rrs.getYear = '2013';
rrs.GetReportDetails();

}

}

When i  deployed my trigger from sanbox to production , the deployement is failed , i  found that  at least 1% code coverage should need to have in order to deploy...but this trigger have 0% code coverage?  what should i do? hw to increses code coverage for this trigger?

 

 

 

trigger UpdateEventRating on Event (before insert, before update) {
for(Event E : Trigger.new){
if(E.Rating__c=='-Excellent Meeting (committed to business within 3 weeks)'){
E.Rating_Value__c=5;
}
else
if(E.Rating__c=='-Good Meeting (Resulted in client meeting agreed to/set or booked a seminar)'){
E.Rating_Value__c=4;
}
else
if(E.Rating__c=='-Productive Meeting (Client specific illustration requested or next meeting scheduled)'){
E.Rating_Value__c=3;
}
else
if(E.Rating__c=='-Average Meeting (Agreed to continued discussions, no client specific activity)'){
E.Rating_Value__c=2;
}
else
if(E.Rating__c=='-Poor Meeting (No potential for future business, no further activity needed)'){
E.Rating_Value__c=1;
}
}
}

I have 2 custom objects application and job  both r part of different managed packages. i can see application in related list of jobs but m not able to make job available in related list of application. is there any solution for this???????????

Hi

 

I have 4 checkbox field and a commandbutton on my vf page. My requirement is out of 4 checkbox atleast 1 must be true . if not then it show error on  click of that commandbutton. 

 

How should i approch this?

 

Thanks

Ishan Sharma

Howdy Folks!  I am trying to write a trigger that will work like a roll up summary field.  I have to run this through a trigger as I cannot create a master detail relationship with a managed custom object.  This is using docusign.

 

The use case is this.  When a doc is marked as completed in the custom object Docusign status (dsfs__DocuSign_Status__c).  I need to get a count of items either completed or Denied and use that data to manage the Opportunity stage.

 

If status =complete, stage = Closed Won

if Status=Denied, Stage = Closed Lost

 

Has anyone run into this issue?!  I cannot believe I am the first one to need this automation.  Thanks folks!

I know there is a way to pop-up a box when a button is clicked with an alert, is there a way to also add fields to that pop-up to have the user fill in?

  • May 28, 2013
  • Like
  • 0
Hey guys,

Could you please let me know, can we hide/add pagination bar for specific user in salesforce classic view, If it can be hided/added, which feature or place to acheive this.How can we do this ?

Appreciate, early response!

Thanks!
Srinivas  
  • August 20, 2019
  • Like
  • 0
Hi Everyone!

I am facing the above provided of exception in PROD but not in Sandbox. Initially i thought this might be because of couple of things.

1. Writing Queries inside loop.
2. Record's Data problem.

I thoroughly checked the code and i was not able to see any queries inside the loop.
If i think recurrsion is going on, this has to be done in sandbox also, but the exception is not reproducable in Sandbox.
Could some one help me on this situation, am i missing any thing to crossverify, that will be so great.

Thanks!
Srinivas
 
  • January 20, 2017
  • Like
  • 0
Hi Everyone,

I have functionality to work on same as like Send Meeting Request button functionality.
Let me explian you very clearly, Lets Consider lead object and its relatedlist has Open activities.Which has Send Meeting Request button.When i click on that button,popup appears with several details and with a calendar to pick a date,how ever we used to send a mail,as a meeting request.

I need the same functionality for Custom Object.But as per the below link,we cannot achieve.
http://salesforce.stackexchange.com/questions/38667/schedule-meeting-for-a-contact-from-custom-vf-page-similar-to-cloud-scheduler-f

I need a way to achieve the same.Could some one share your Idea's so that i can go ahead and complete the same.

Thanks,
Srinivas Gupta
 
Hello

When i am Uploading some data around 15000 records using apex.
i am facing this error "regex too complicated"
in this line,like when i split complete rows by new line after that doing the next steps.
When i upload lesser like 1000 round it is successfull.
filelines = nameFile.split('\n');
Could any one please help me out or suggest me any way to free out from this error.

Regards
Srinivas


 
  • December 10, 2014
  • Like
  • 0
Hello Guys ,
   Hope your doing good,
Can we deploy Chatter object and fields and its data including attachments using Eclipse in Salesforce.
Could you please tel me a way ?
Thanks in advance.

Regards
Srinivas

 
  • November 17, 2014
  • Like
  • 0
Hello Friends,

My Requirement is when you hit a button in detail page,it calls a controller(Schedulable Class) method and that adds me to schedule class.
and schedule runs after 20 minutes then emails will be sent to contact.
I have acheieved this requirement with out any issue.Now what suggestion i need from you guys is in test class like putting assert for email sent  response.
like Issuccess().
Email will be sent after 20 min and test class is running instantly.How to cover that part.
Early Reponse is much Appreciated.

Thanks
Srinivas
SFDC Developer.






 
Hi , am new to salesforce . Is any other way to create auto increment for a text field when a new record is created.
I am having a VF page which has input text and i made them required by wrapping in outputlabel.
Like this
 
<apex:pageBlockSectionItem >
               <apex:outputLabel value="Contact Email"/>
               <apex:outputPanel layout="block" styleClass="requiredInput">
               <apex:outputPanel layout="block" styleClass="requiredBlock"/>
               <apex:inputtext label="Email" value="{!contactemail}"/>
               </apex:outputPanel>
            </apex:pageBlockSectionItem>

I would like to display error message when email field is not filled.

I am giving <apex:pagemessages /> in Vf page and below add message in apex class before i upsert contact.

if( Email == null || email== '' ){
    ApexPages.addMessage( new ApexPages.Message( ApexPages.Severity.ERROR, 'Please enter Email'));
   return null;           
}
Still it doesnt work.Please guide me where am i going wrong.
 
Hello, hopefully some of you have some experience with this.  We are currently deploying the Duplicate Management and when the rules are deployed in "Alert" mode (not blocking), the VF page still shows an error and whether or not the record is inserted seems a bit random.  (We've not researched that part yet).

My question is this... does anyone know if it's possible to differentiate a Duplicate Management Alert from an Error via APEX?   If we could know what it is, we could code accordingly.

Thanks
Hello All,

We have a test class that is causing errors when I try to move items into production. I know what is causing the error (I am not a developer and we do not have one here) it is the last line that when the developer created the test case would have been null, but since then there was a change. I just need to comment out one line.

I know how to comment out the line, I just don't know how to get that test class back into prod, when I try the test runs and errors out so it is basically a catch22 here. Thanks in advance for any assistance.
Hi Guys,

Can anyone suggest how to send a summarised email alert at the end of the day with the newly created opportunities?

Thanks,
Yamini.
  • January 23, 2015
  • Like
  • 0
Hi,

I currently have an SOQL query that gets a list of users who are of a specific profile and are active, which looks like this:
[SELECT Id, Name FROM User WHERE Profile.Name = 'Pollinators' AND IsActive = TRUE ORDER BY Name ASC]

This list is used to populate a dynamic picklist that managers user to access filtered reports. However, my business is expanding into new cities and so I want to also filter this list by showing only users who are in the same city as the manager.

I figured the best way to do this is to match the City field value on the User's record page. Upon doing some reading, I found a list of UserInfo Methods, and I can't see anything in there for City.

Can anyone help with how I might acheive this?
Thanks
 
  • January 21, 2015
  • Like
  • 0
Hi,

I have a @future method in apex class and I am calling that method thro after insert trigger.
Rest callout code is present in the future method.
How to show error message on salesforce standard ui when rest callout fails?
  • January 21, 2015
  • Like
  • 0
In a custom object I have a dependent picklist, and I have provided field level access(read/write) through permission sets. If i provide Read&write permission for Dependent field and only Read permission permission for Controlling field, I got the below error while loading the page.

ERROR: "The dependent picklist 'Dependentfield' requires its controlling field 'Controllingfield' to be present on the page."

Can anyone tell is this is the standard behaviour of salesforce or i need not do anything to make it work fine?

Thanks in advance.
Hi all, 
       When i click on any price book, make it so that the Cost field appears as a column between Product Code and List Price. I cannot using wron icon in to  product. why?

Thanks in advance
I have one custom field "Notify me on new release" whose data type is checkbox. I want to add those user to specific group name "Alert" when user select "Notify me on new release" check. How can i achieve this?? any help will be appericiated .
Hi,
      trigger autoCreatOpp on Case (after insert, after update)
{
list<Opportunity> getOpp = new list<Opportunity>();
list<Opportunity> newOpp = new list<Opportunity>();

set<id> caseid = new set<id>();
for(Case newCase : Trigger.new)
{
if(newcase.status == 'Escalated')
caseid.add(newCase.id);
}

getOpp = [select id,recordtypeid,Orginating_Case__c  from Opportunity where recordtype.name='Professional_Service_Change_Order' and Orginating_Case__c =: caseid ];

for(Case c : [select id,status,casenumber,accountid,subject from case where id =: caseid ])
{
if(getOpp.size() == 0)
{
Opportunity opp = new Opportunity();
opp.name = c.accountid +'-'+ c.subject;
opp.accountid = c.accountid;
opp.recordtypeid='012j0000000WH2U';
opp.closedate = system.today()+30;
opp.stagename = 'Open';
opp.Orginating_Case__c = c.casenumber;
newOpp.add(opp);
}
}
insert newOpp;
}

help me...
Hi,

I have a log file in my system. I need to upload that file to salesforce and then send an email to client by attaching that file. Please suggest me the approach to do this. Also,the file should be stored in salesforce

Thanks,
Ganesh
Hello

When i am Uploading some data around 15000 records using apex.
i am facing this error "regex too complicated"
in this line,like when i split complete rows by new line after that doing the next steps.
When i upload lesser like 1000 round it is successfull.
filelines = nameFile.split('\n');
Could any one please help me out or suggest me any way to free out from this error.

Regards
Srinivas


 
  • December 10, 2014
  • Like
  • 0
public class ClientProfile 
{
    public Boolean bool {get;set;}
    public Boolean bool1 {get;set;}
     private final  Client_Profile__c order;
     public Client_Profile__c getorder()
     {
         return order;
     }
     public ClientProfile(ApexPages.StandardController stdController) 
     {
        order = (Client_Profile__c)stdController.getRecord();
           
           
     }
     public PageReference next() 
     {
                
       PageReference np = new PageReference('/apex/ClientProfile1');
        np.setRedirect(false);
         return np;                 
    }
    public PageReference Continue1() 
     {
       PageReference np1 = new PageReference('/apex/ClientProfile2');
       np1.setRedirect(false);
       return np1;   
    }
     public PageReference Continue2() 
     {
     
      
       PageReference np2 = new PageReference('/apex/ClientProfile3');
        np2.setRedirect(false);
        return np2;   
    }
    public PageReference back() 
     {
       PageReference np3 = new PageReference('/apex/ClientProfile');
       np3.setRedirect(false);
       return np3;   
    }
     public PageReference back2() 
     {
       PageReference np4 = new PageReference('/apex/ClientProfile1');
       np4.setRedirect(false);
       return np4;   
    }
     public PageReference back3() 
     {
       PageReference np5 = new PageReference('/apex/ClientProfile2');
       np5.setRedirect(false);
       return np5;   
    }
    public PageReference save() 
    {
        insert order;
        PageReference np6 = new PageReference('/apex/Thankuform');
        np6.setRedirect(true);
        return np6;
    }
  /* public List<SelectOption> getTypes()
    {
       Schema.sObjectType sobject_type = Client_Profile__c.getSObjectType();
       Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
       Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();          
       List<Schema.PicklistEntry> pick_list_values = field_map.get('Type_of_Company__c').getDescribe().getPickListValues();
       List<selectOption> options = new List<selectOption>();
       for (Schema.PicklistEntry a : pick_list_values) 
       {
          options.add(new selectOption(a.getLabel(), a.getValue()));
       }
      return options;
   }*/
}
trigger PopulateMemberNumber on Account (before insert) {

    List<Member_Number_Configuration__c> MN = Member_Number_Configuration__c.getAll().values();
    System.debug (MN);
    
    String zero='00000';
        
  for (Account a : Trigger.new)
  {
      
      for(Member_Number_Configuration__c tmpMn : MN)
      {
          
          if(tmpMn.City__c == a.City__c && tmpMn.Campus__c == a.Preferred_Campus__c)
          {
    
              Number StartingNumberLength = String.valueOf(tmpMn.Starting_Number__c).length();                         (show error:"Invalid number")
              Number Addzero   = zero.length()-StartingNumberLength;
                  
               a.Member_Number__c = tmpMn.City_Code__c+''+ tmpMn.Campus_Code__c+''+ (tmpMn.Starting_Number__c);
              
              break; 
          }
      }
}
}
My trigger is Working Fine, Apex Class is Working Fine, Only Test Class is Problem
This is my Test class Code:
@isTest
    private class testcountOppLineItmsCount {
    static testMethod void testcountOppLineItmsCount() {
        List<OpportunityLineItem > lstoplitm= new list<OpportunityLineItem >();
       Opportunity o = new Opportunity(name='test opp1', CloseDate=date.today(), StageName='Closed Own');
       insert o;
      
           
      OpportunityLineItem op=new OpportunityLineItem (quantity=1,Opportunityid=o.id, TotalPrice=100  );
      insert op;
     lstoplitm.add(op);
     
      insert lstoplitm;
      countOppLineItmsCount.Change(lstoplitm);
       }
       }

Error is:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId, unknown (versions 3.0 and higher must specify pricebook entry id, others must specify product id): [PricebookEntryId, unknown]

--

I am New for this PricebookEntry.. psl correct my code or tell me wht shall i do?

thaks