You need to sign in to do that
Don't have an account?
APEX: Debug Log
I have been developing "trigger " code for the first time.
I have two questions:
Question 1. I would print out certain aspects of the code as it is executing ... My understanding is that you can use the System.debug statement and look at the Debug Log the information between the single quotes ' Field Print'. Unfortunately, this is not working for me.
Triigger Name on CustomObject__c (Before Insert) {
Question 2. I would like to print a variable instead of a Field in Quotes. Do I need to set a vaiable?
Example: Trigger Name on CustomObject_c(Before Insert) { System.debug (CustomObject__c.variable); }
Any help would be appreciated. Thank you |
Here are some sample debug statements:
System.debug('******************* About to process sales.... '); //define a variable here integer saleCounter = 0; for (CustomSale__c cSale: SalesToProcess.values()){ System.debug('******************* Current Sale Quantity: ' + cSale.Quantity__c ); //Do stuff with each sale... //... increment the counter saleCounter++; } System.debug('******************* Number of sales processed: ' + saleCounter);
Note that you can put any message you want in between single quotes (I use a series of ***'s to make my messages stand out in the debug log).