You need to sign in to do that
Don't have an account?
vanessa
javascript on customize button
hi everyone.
i put a button(through "buttons &links") on a custom object. I want to when the user click on the button, through javascript clear a field on the custom object.
Anyone can help me?
my code
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")};
var partidafinanceira= new sforce.SObject("Partidas_Financeiras__c");
partidafinanceira.name = '{!Partidas_Financeiras__c.Name}';
for (var i_tem = 0; i_tem <partidafinanceira.length; i_tem++){
{!Partidas_Financeiras__c.Processo_de_Cobranca__c}.value="''};
Why do you need the loop - for (var i_tem = 0; i_tem <partidafinanceira.length; i_tem++)
What are you try to do :-
1. Blank out the value just on the page? If yes , then just do a -
document.getElementByid("htmlControlname").value="";
2. if you are not trying 1 above then you must be trying to blank out the value in database
for that do the following:-
var partidafinanceira= new sforce.SObject("Partidas_Financeiras__c");
partidafinanceira.id = '{!Partidas_Financeiras__c.id}';
partidafinanceira.Processo_de_Cobranca__c="';
and then do update it to get it committed to the database.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi!
Yes im trying to do the second option.
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")};
var partidafinanceira= new sforce.SObject("Partidas_Financeiras__c");
partidafinanceira.id = '{!Partidas_Financeiras__c.Id}';
partidafinanceira.Processo_de_CobrancaId__c= " ";
var result = sforce.connection.update(partidafinanceira.Processo_de_Cobranca__c);
window.location.reload();
when i make a test, the error is : arg 0 'sObjects' not specified
i dont understand. can u help me?
the loop it was for "looping" all the id selected on the relateds list
Instead of :-
var result = sforce.connection.update(partidafinanceira.Proceso_de_Cobranca__c);
use:-
var result = sforce.connection.update(partidafinanceira);
the same error : arg 0 'sObjects' is an array. But passed in value is not an array :smileysad:
i have to do this to solve:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")};
var partidafinanceira = new sforce.SObject("Partidas_Financeiras__c");
partidafinanceira["id"] = "{!Partidas_Financeiras__c.Id}";
partidafinanceira["Processo_de_Cobranca__c"]= " ";
var result = sforce.connection.update([partidafinanceira}]);
window.location.reload();
but....... dont put blank on the field "processo_de_cobranca__c"
Replace
var result = sforce.connection.update([partidafinanceira}]);
with
var result = sforce.connection.update([partidafinanceira]);
There is an additional '}' in the code.
Thanks
HC