function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RobinHoodRobinHood 

Deleting from the database SOQL

Hi,

 

I want to delete the record returned from the following query, how do I delete it ?

 

 //To remove property from the database
    function removePropertyFromDB(propertyId, PreviewListId){
           var unWantedPropSql = sforce.connection.query("Select Importance__c, MLSProperty__r.Name, Preview_List__c  From Preview_List_Property__c p where MLSProperty__r.Name = '" + propertyId + "' and Preview_List__r.id = '" + PreviewListId + "'");
        }

//the above query returns 5 rows of record, how do I delete these rows ? pls help me out !

 

Thanks,

 

Suresh

ScoobieScoobie

List<Preview_List_Property__c> forDelete = [Select Importance__c, MLSProperty__r.Name, Preview_List__c  From Preview_List_Property__c p where MLSProperty__r.Name = '" + propertyId + "' and Preview_List__r.id = '" + PreviewListId + "'"];

 

delete(forDelete);

 

 

RobinHoodRobinHood

I'm getting the "Invalid assignment left-hand side' error...

tantotanto

You need to query the object for the Id's of the records you want to delete, add these Id's to a list, and then do a delete (listName).