You need to sign in to do that
Don't have an account?
Mig
Problem with List button onclick Javascript
Hi,
I created a List Button :
List Button code :
This code will change the Status of the selected Orders. It works fine But a few times (in I.E. 7.0) I've got a weird error :
Something like : 'Error On Click Javascript Sforce is not defined ';
Please, can someone help me on this ? I don't understand this error. (Apparently It's only for some no Admin Profile users... and always in I.E. 7.0 even if I had that error once in firefox in admin profile :s but once I refreshed it was ok) I tryed already to update I.E, but does not work!
Thank you in advance for your help; this is really very important ...
Mig
Message Edited by Mig on 02-12-2008 01:13 PM
I created a List Button :
List Button code :
Code:
{!RequireScript("/js/functions.js")} var recordsToTransfer = {!GetRecordIds($ObjectType.Order__c)} function init(){ if(recordsToTransfer.length < 1){ alert(" Please Select a value") ; } else if (!document.elementsAddedToPage) { for(var i=0; i < recordsToTransfer.length ; i++) { Edit(recordsToTransfer[i]); } } } function Edit(OrderID){ var Edit = new sforce.SObject("Order__c"); Edit.Id = OrderID; Edit.Order_Status__c = "Ready"; var result = sforce.connection.update([Edit]); window.location.reload(); } init();
This code will change the Status of the selected Orders. It works fine But a few times (in I.E. 7.0) I've got a weird error :
Something like : 'Error On Click Javascript Sforce is not defined ';
Please, can someone help me on this ? I don't understand this error. (Apparently It's only for some no Admin Profile users... and always in I.E. 7.0 even if I had that error once in firefox in admin profile :s but once I refreshed it was ok) I tryed already to update I.E, but does not work!
Thank you in advance for your help; this is really very important ...
Mig
Message Edited by Mig on 02-12-2008 01:13 PM
I have no idea if it will change something ...
You need to add first connection.js and then function.js also check which js file version u r using.
You should only need to include one of the RequiredScript tags since that is what determines what commands you use. If you use the first code below it will give you all of the recent API commands. I also included an Execute JavaScript button code to update the Contact addresses as an example.
Forgive the formatting of the code, I don't have the development tool to get the original code here.
Please let me know if you have questions.
Indeed it works fine !