+ Start a Discussion
Mayank Deshpande 2Mayank Deshpande 2 

Facing issue on system.debug ()

Hi All,
I am new in salesforce . i write a code to insert  a record in custome object and used system.debug to check the code .

Public Class inserrecordincampsite
Public Static Void InsertRecord()
Campsite__c Camp = new Campsite__c  (Name='Mayank',Description__c='xyz');
insert Camp;
system.debug('Record Inserted'  +Camp)

after exeuction of code through anonymous window , debug message generated is blank and showing 0 DML operation performed.

can anyone suggest wht's wrong in code .
Chamil MadusankaChamil Madusanka
Can you post a screenshot or file of the debug run result?
Amit Chaudhary 8Amit Chaudhary 8
Please share the code which you execute from anonymous window  ?

Can you please try below code

Let us know if this will help you

Shiva RajendranShiva Rajendran
Hello Mayak ,
Could you share how you executed the code?
inserrecordincampsite.InsertRecord() should work in anonymous window!
Also try to see if it throwed any error or not like that.See if all the mandatory fields of Campsite__c  object is set or not . that can throw an error during insert operation.
Thanks and Regards,
Shiva RV