You need to sign in to do that
Don't have an account?

Using JS popup to fill a field and save a record
Hi All
Please excuse my noviceness here. I have found some blocks of JS which im trying to use for my solution.
The goal of this is to have a button that the user can click which will prompt them with a popup to provide text, upon providing the text the user will click OK, the text will be placed into 'Reason__c' and the other fields will be updated with the predefined values.
The record should then save.
So far i have.
Any help or pointers would be grealy appreicated.
Thanks in advance
Dale
Please excuse my noviceness here. I have found some blocks of JS which im trying to use for my solution.
The goal of this is to have a button that the user can click which will prompt them with a popup to provide text, upon providing the text the user will click OK, the text will be placed into 'Reason__c' and the other fields will be updated with the predefined values.
The record should then save.
So far i have.
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")} var reason = prompt("Enter reason", ""); if (reason != null) { var opportunity = new sforce.SObject("Opportunity"); opportunity.id = "{!Opportunity.Id}"; opportunity.StageName = "Closed Lost"; opportunity.Loss_Reason_Select1__c = "Reason6"; opportunity.Reason__c = reason; var result = sforce.connection.update([opportunity]); if (result[0].getBoolean("success")) { // Refresh window window.location.reload(); } else { alert("Error saving opportunity"); }
Any help or pointers would be grealy appreicated.
Thanks in advance
Dale
Just add one more '}' at the end. This will fix your issue.
All Answers
Just add one more '}' at the end. This will fix your issue.
I cannot believe it. What a clown.
Cheers
Dale