You need to sign in to do that
Don't have an account?
Laura Babb 4
Need help writing apex test for my trigger please!
I have done the Trailhead on Apex Unit Tests, and I just don't seem to be getting it. I wrote a trigger that will update my Opp Stage when my DocuSign Envelope Status = Completed. I need to test this so I can move it production. Your help is greatly appreciated!
Trigger updateRelatedOpportunity on dsfs__DocuSign_Status__c(before insert,before update){ List<Id> oppIds = new List<Id>(); for(dsfs__DocuSign_Status__c dc:trigger.new){ if(dc.dsfs__Envelope_Status__c =='Completed'){ oppIds.add(dc.dsfs__Opportunity__c); } } List<Opportunity> oppList = [select StageName from Opportunity where id in:oppIds]; List<Opportunity> oppListnew = new List<Opportunity>(); for(Opportunity op : oppList){ op.StageName ='SOW Received'; oppListnew.add(op); } update oppListnew; }
In process builder, you should check isnull false before getting any values. So, you will not get any exception on null values. If values are there, it will update the values as per the logic. Then why you are going for trigger seperately. In out of box itslef you can do this implementation.
Regards,
Navin
All Answers
In process builder, you should check isnull false before getting any values. So, you will not get any exception on null values. If values are there, it will update the values as per the logic. Then why you are going for trigger seperately. In out of box itslef you can do this implementation.
Regards,
Navin
only cid:image like can able to see