You need to sign in to do that
Don't have an account?
SFDC_Developer
Update Record on click of javascript button
I want to update one record on click of javascript button, I am able to fetch record but not able to update that one. Below is my code:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} var myquery = "SELECT Field__c FROM Object WHERE Name = '1' limit 1"; result = sforce.connection.query(myquery); records = result.getArray("records"); if(records[0]){ var myObj = records[0]; } alert(myObj.Field__c); myObj.Field__c = 'Hello'; alert(myObj.Field__c); var results = sforce.connection.update([myObj]); alert(results);
But I want to know why I need to include Id in my query.
I am trying tu use this code but unfortunatelly, I cant Update!
As i could checked the trouble is into Result CODE
alert(nestedDiv.textContent);
How can i Invoque {!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
Regards
for Invoking Requirescript just use it before the java script.
Me lo traigo de una tabla y le puse un Alert para chequarlo y eso esta OK.
<apex:includeScript value="/soap/ajax/30.0/connection.js"/>
<apex:includeScript value="/soap/ajax/30.0/apex.js"/>
es esa la forma de invocar el ajax? o el error puede ser eso mismo??
nestedDiv.textContent is a variant value looked up by Id into another table with Orders Id to be updated.
I think so that the problem will be including Ajax into apex code
I used the following lines:
<apex:includeScript value="/soap/ajax/30.0/connection.js"/>
<apex:includeScript value="/soap/ajax/30.0/apex.js"/>
Is it ok?