You need to sign in to do that
Don't have an account?
Katie Christensen
Custom OnClick JavaScript Button to Update Status and Allow additional input
I created a custom OnClick JavaScript that marks a case as escalated and allows the user to enter comments. I'd also like the user to be able to enter a value for a custom text field called Escalated_By__C. I'm not familiar with Java so can anyone tell me how I would add an input field. Current code is:
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.IsEscalated = 'True';
var result = sforce.connection.update([caseObj]);
if (result[0].success == 'false') {
alert(result[0].errors.message);
} else {
parent.ID = '{!Case.ParentId}';
window.parent.location = ('/00a/e?parent_id={!Case.Id}&IsPublished=1&retURL=/{!Case.Id}');
}
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.IsEscalated = 'True';
var result = sforce.connection.update([caseObj]);
if (result[0].success == 'false') {
alert(result[0].errors.message);
} else {
parent.ID = '{!Case.ParentId}';
window.parent.location = ('/00a/e?parent_id={!Case.Id}&IsPublished=1&retURL=/{!Case.Id}');
}
On custom onclick, you will not be able to put an input field to take input from user. You can just hard code the value in the code itself. If you want to put input field, you need to work with visualforce pages.
I can help you out on pages, you can contact me either on my gmail id: neetu.bansal.5@gmail.com or Skype id: neetu.bansal.5
Thanks,
Neetu