You need to sign in to do that
Don't have an account?
Sarath C R
Custom button to display a picklist
I have to use a custom button to update a picklist. The field is 'Industry' in the 'Lead' tab. I have created the button and entered the java script below
{!REQUIRESCRIPT ("/soap/ajax/24.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.Lead)};
var newRecords = [];
if (records[0] == null) {
alert("Please select at least one lead")
}
else {
for (var n=0; n<records.length; n++) {
var c = new sforce.SObject("Lead");
c.id = records[n];
c.Industry =new Industry;
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}
but its showing the error like ' Industry is not defined '.
Can anyone help?
{!REQUIRESCRIPT ("/soap/ajax/24.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.Lead)};
var newRecords = [];
if (records[0] == null) {
alert("Please select at least one lead")
}
else {
for (var n=0; n<records.length; n++) {
var c = new sforce.SObject("Lead");
c.id = records[n];
c.Industry =new Industry;
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}
but its showing the error like ' Industry is not defined '.
Can anyone help?
c.Industry = new Industry;
What value are you trying to pu into c.Industry?
c.Industry is a Text field and requires a text value.
Doing '= new Industry' is not valid as Industry is not defined anywhere in your code, hence the error.
You could try something like c.Industry = "Technology" which would be valid because "Technology" is a literal value but would be static and not dynamic.
the above line has a problem. Industry is the Picklist type on Lead. so it can have a string value
c.Industry = ""; or c.Industry = "Industry";