+ Start a Discussion
MohanaGopalMohanaGopal 

Delete Override Problem

Hi..
 
          I have overrided my custom object delete button using S-control... 
 
Because when I delete my record I have to delete this connector object record also.. 
 
There is no master detail connection between my object and connector object..
 
Here is my code..
 
Code:
<html> 
<script type="text/javascript" src="/soap/ajax/9.0/connection.js"></script> 
<script> 
function init() 
{
var taskqry=sforce.connection.query("select Id,Project__c from Custom_Tasks__c where Id='{!Lighting_Measures__c.TaskId__c}'");
var taskRec=taskqry.getArray('records');

var conf=confirm('Its delete connector object records also.Do you want to continue');
if(conf==true)
{
try{
var conObj=sforce.connection.query("select Id,Lighting_Measures__c from Task_Connector__c where ID ='{!Lighting_Measures__c.Id}'");
}catch(e){alert(e);}
alert(conObj);

var conRec=conObj.getArray('records');
alert(conRec.length);

for(i=0;i<conRec.length;i++)
{
alert(conRec[i]);
var delConRec=sforce.connection.deleteIds([conRec[i]]); 
}

var delrec=sforce.connection.deleteIds(['{!Lighting_Measures__c.Id}']); 

window.parent.location.replace("https://na5.salesforce.com/"+prjRec[0].Id); 
} 
else
{
window.parent.location.replace("https://na5.salesforce.com/"+taskRec[0].Project__c ); 
}
}
init(); 
</script> 
</html>

 
I got following error
 
Code:
---------------------------
Windows Internet Explorer
---------------------------
{faultcode:'sf:INVALID_FIELD', faultstring:'INVALID_FIELD: 
select Id,Lighting_Measures__c
          ^
ERROR at Row:1:Column:11
No such column 'Lighting_Measures__c' on entity 'Task_Connector__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.', detail:{fault:{exceptionCode:'INVALID_FIELD', exceptionMessage:'
select Id,Lighting_Measures__c
          ^
ERROR at Row:1:Column:11
No such column 'Lighting_Measures__c' on entity 'Task_Connector__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.', row:'1', column:'11', }, }, }
---------------------------
OK   
---------------------------

 
But In my Task_connector__c object I have a field 'Lighting_Measures__c' ..
 
What is the problem here...
 


Message Edited by MohanaGopal on 01-07-2009 11:54 PM
aalbertaalbert
Are you logging in as an end-user who doesn't have access to that field? The SControl will enforce the field level security (along with all other user and profile permissions)
so if the user who you are testing with doesn't have access to that field, you will run into that error. Does this work if you log in as a System Admin who definitely has the permissions?

werewolfwerewolf
Why don't you do it with an Apex trigger instead?
MohanaGopalMohanaGopal
Hi..
 
        Thanks for ur reply..
 
Why I have recieved No Such column error message even though that filed exist in my object....
 
What is the problem here....? How to avoid it...?
 
werewolfwerewolf
The problem is likely exactly what aalbert described -- you're logging in as a user who does not have field level security to that column, so from his perspective the column does not exist.  This would not be an issue if you did this in an Apex trigger.
MohanaGopalMohanaGopal

Hi..

Thanks for ur reply..

I have loggin as a admin profile.

That field Lighting_Measure__c is a lookup field in Task_Connector__c object...

 
In that Task_Connector__c object Lighting_Measure__c field "Set Field-Level Security" is visible true for all profiles
and "Field access" is Editable for all profile..
 
I want to know what is the issue here...
 
Why its shows "No such column" Error message...
 
I am using Excel connector to pull all fields from Task_Connector__c object.
Here also I didnt see the Lighting_Measure__c field...
 
I have tried Server URL is : https://www.salesforce.com/services/Soap/c/6.0 ,7.0, 8.0 , 9.0  using advanced search in Excel connector... Even I didnt see that field...
 
What is the problem here... How to get that field in Excel connector and S-control query...
 
 
 
 
werewolfwerewolf
The funny thing is that the error says
Calculated_Lighting_Measures__c

I don't see anything about that field in your code.

Also, this sure doesn't look right:


"select Id,Lighting_Measures__c from Task_Connector__c where ID ='{!Lighting_Measures__c.Id}'"

It may be unrelated, but you appear to be trying to select a Task_Connector__c using a Lighting_Measures__c ID.
MohanaGopalMohanaGopal

Hi..

Thanks for ur reply...

Once again I repeat my problem..
 
I have Lighting_Measures__c and Task_Connector__c object.
In Task_Connector__c object has a Lookup field Lighting_Measures__c.
I have override Lighting_Measures__c delete button.
I am using following code in my scontrol.
 
"select Id,Lighting_Measures__c from Task_Connector__c where Lighting_Measures__c='{!Lighting_Measures__c.Id}'"
 
I got "No such column"  Lighting_Measures__c error.
 
What is the problem here..?
werewolfwerewolf
Are you sure you don't just have a typo in the field name?
MohanaGopalMohanaGopal
Hi..
 
Thanks for ur reply...
 
 
I am sure. There is no typo here...
 
Even  I couldnt fetch Lighting_Measure__c field throw Excel connector.
 
I am using Excel connector to pull all fields from Task_Connector__c object.
Here also I didnt see the Lighting_Measure__c field...
 
I have tried Server URL is : https://www.salesforce.com/services/Soap/c/6.0 ,7.0, 8.0 , 9.0  using advanced search in Excel connector... Even I didnt see that field...
 
What is the problem here... How to get that field in Excel connector and S-control query...