• vinodrajput1.3947816596948318E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
We have a product specification form (Product_Brief__c) that once saves needs to insert a Project.  Once that Project is inserted, I need to take the Project ID and update the Product Brief with that ID.

The code below works properly to create a Project.  When I try and use that Project ID to update the Product Brief (last two lines of code) it gives me this error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY.

Any help here would be much appreciated!
trigger ProjectCreation on Product_Brief__c (after insert, after update) {

    Product_Brief__c pb = [SELECT ID, Opportunity__r.ID, Opportunity__r.Owner.ID, Select_Product__c, Related_Project__c FROM Product_Brief__c WHERE ID =: trigger.new];
    
    Project__c p = new Project__c();
    p.RecordTypeID = '012W00000008nXT';
    p.Related_Opportunity__c = pb.Opportunity__r.ID;
    p.Sales_Rep__c = pb.Opportunity__r.Owner.ID;
    p.Project_Description__c = pb.Select_Product__c;
    p.Project_Category__c = 'Bags and Tubing Sets';
	p.Status__c = 'Active';
    p.Start_Date_and_Time__c = System.Now();
    
    insert p;
    
    pb.Related_Project__c = p.ID;
    
    update pb;
}

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.