You need to sign in to do that
Don't have an account?
anil87
change lead owner through a custom button in search results page
Hi,
We like to have a Custom Lead Accept button which would be used on the Search Results Page.
When the user selects the Leads and clicks the button, it should assign the Lead ownership to the Person who clicked the button.how i can achieve this any help appriciate greatly
Hey Anil,
Try below code :-
{!REQUIRESCRIPT ("/soap/ajax/24.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.Lead)};
var newRecords = [];
if (records[0] == null) {
alert("Please select at least one row")
}
else {
for (var n=0; n<records.length; n++) {
var c = new sforce.SObject("Lead");
c.id = records[n];
c.OwnerId ="{!$User.Id}";
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}
All Answers
Hey Anil,
Try below code :-
{!REQUIRESCRIPT ("/soap/ajax/24.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.Lead)};
var newRecords = [];
if (records[0] == null) {
alert("Please select at least one row")
}
else {
for (var n=0; n<records.length; n++) {
var c = new sforce.SObject("Lead");
c.id = records[n];
c.OwnerId ="{!$User.Id}";
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}
Hi Vineet,