• SathyaTrekbin Tech
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
hi iam actually trying to prepare a table where i want to push map data into list ? what is the approach to move data of map to a list in apex
I have like to compare previous lookup field value and current lookup field value. If it is same value record is saved, otherwise throw error message.
I have written triggers for single object modification, but this is something beyond my merit.
Plan is to update a custom date field on Opportunity when an Opportunity Team member/record gets deleted.
Any help is appreciated.
Thanks!
Hi Everyone,

I have a trigger that was properly ran in sandbox. When i try to deploy it into production getting deployment failed. The details shown below.

Apex Test Failures:
TestMultipleDLsTrigger validateMDLs System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, BulkPricebookOpp: execution of BeforeInsert caused by: System.QueryException: List has no rows for assignment to SObject Trigger.BulkPricebookOpp: line 7, column 1: []
Stack Trace: Class.TestMultipleDLsTrigger.validateMDLs: line 5, column 1


Trigger :

trigger BulkPricebookOpp on Opportunity (before insert,before update)
{   
    Id pbID = null;
    Id recordtypId = null;   
    pbID = [Select Name, Description From Pricebook2 where Name =: 'Bulk Price Book'].Id;
    recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'k) Bulk Services'].Id;   

   for(Opportunity obj : trigger.new)
   {
        if(obj.RecordTypeId  == recordtypId)
        {
            obj.Pricebook2Id = pbID;
        }
        }
        }

Is it the reason that which i directly called "Bulk Price Book" name.

Is need to modify trigger in sandbox??

Please any one help on this.