+ Start a Discussion
MarkMCCMarkMCC 

Change Owner Button

I'm recently new to the Salesforce.com service (so be gentle :smileyhappy: )  and I'm trying to create a button that would allow a user to send a record to a queue. 
 
What I'm creating is a quote form, our sales reps will fill out the quote form and from here click a button that would send the quote to the quotes queue.  I have done some searching, but havent really found anything.   
 
Can someone point me in the right direction?
TCAdminTCAdmin
Hello MarkMCC,

As long as you have EE or above, access to the API, you should be able to modify the code below. You will want to make it a custom button on the object with OnClick JavaScript. By changing the object and the queue ID you can use this to change the owner of a record with a single click.

Code:
{!REQUIRESCRIPT("/soap/ajax/12.0/connection.js")} 

var thisLead = new sforce.SObject("Lead"); 

thisLead.Id = '{!Lead.Id}'; 
thisLead.OwnerId = '00G500000019H32'; 

var saveResults = sforce.connection.update([thisLead]); 

if(saveResults[0].success == 'false'){ 
alert('an error occured: ' + saveResults[0]); 
} 

window.location.href = '/{!Lead.Id}';