Getting DML statement code error , please help resolve! - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Mrigank SharmaMrigank Sharma 

Getting DML statement code error , please help resolve!

Here's the code:

public class SingleDml 
{
    public void insertBuilding()
    {
        Building_Object__c building= new Building_Object__c();
        building.Name ='Mrigank';
         building.State__c= 'Haryana';
        insert building;
              
    }
    public void deleteBuilding()
    {
        Building_Object__c building=[select Name from Building_Object__c where Name='Ajanta Flats'];
        delete building;
    }
    public void undeleteBuilding()
    {
        Building_Object__c building=[select Name from Building_Object___c where Name='Ajanta Flats' all rows];   //error: Invalid type: Schema.Building_Object___c
        undelete building;
    }
    public void updateBuilding()
    {
        Building_Object__c building= [select Name from Building_Object___c  where Name='Ajanta Flats'];     //error: Invalid type: Schema.Building_Object___c
        building.Name='Ajanta Big Flats';
        update building;
    }
    
}
Best Answer chosen by Mrigank Sharma
sakshi nagpalsakshi nagpal
You have used three underscores here-:
you shoulduse only 2 underscores like this-:
Building_Object__c 

All Answers

sakshi nagpalsakshi nagpal
You have used three underscores here-:
you shoulduse only 2 underscores like this-:
Building_Object__c 
This was selected as the best answer
Mrigank SharmaMrigank Sharma
Oho! such a silly mistake, wasted a lot time, thanks for saving @sakshi nagpal
sakshi nagpalsakshi nagpal
lol, yes :)