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 

Unable to Delete - SOQL - Passing Parameter through a function

Hi,

 

I'm trying to delete a record from the object Preview_List_Property__c by passing the parameter (propertyId)

below is my function, but the record corresponding to the propertyId is not getting deleted.

 

Any thoughts on this ?

 

function removeFromTheDB(propertyId){
    var unWantedPropSql = "Select Importance__c, MLSProperty__r.ID, Preview_List__c  From Preview_List_Property__c p where MLSProperty__r.ID = '" + propertyId +"'";
    var unWantedPropResult = sforce.connection.query(unWantedPropSql);   
    var unWantedPropResultArray = unWantedPropResult.getArray("unWantedPropResultArray");
    sforce.connection.deleteIds([unWantedPropResultArray]);    
    }


Thanks,

 

Suresh  

Going South.ax738Going South.ax738

you should be using

    sforce.connection.deleteIds([unWantedPropResultArray.id]);