• cbuhr3
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Hello, please excuse this beginner question. I'm looking to create a button that re-assigns the selected case(s) to the current user. Why would I want to do this when there already is a "Change owner" button? Well, let's compare:

 

Change owner:

1. Select  case(s).

2. Click "Change owner" button.

3. Wait for the new page to load.

4. Type in the name of the new owner.

5. Click  "Save".

6. Wait for the case list to load.

 

"Assign to me":

1. Select  case(s).

2. Click "Assign to me" button.

3. Wait for the case list to load.

 

 

Much faster.

 

 

I would guess that the code would look something like this but I'm afraid to try it as I don't want to mess things up:

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Case)};
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("Case");
c.id = records[n];
c.OwnerId = User.Id;
newRecords.push(c);
}

result = sforce.connection.update(newRecords);

window.location.reload();
}

 

  • March 17, 2010
  • Like
  • 0

Hello, please excuse this beginner question. I'm looking to create a button that re-assigns the selected case(s) to the current user. Why would I want to do this when there already is a "Change owner" button? Well, let's compare:

 

Change owner:

1. Select  case(s).

2. Click "Change owner" button.

3. Wait for the new page to load.

4. Type in the name of the new owner.

5. Click  "Save".

6. Wait for the case list to load.

 

"Assign to me":

1. Select  case(s).

2. Click "Assign to me" button.

3. Wait for the case list to load.

 

 

Much faster.

 

 

I would guess that the code would look something like this but I'm afraid to try it as I don't want to mess things up:

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Case)};
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("Case");
c.id = records[n];
c.OwnerId = User.Id;
newRecords.push(c);
}

result = sforce.connection.update(newRecords);

window.location.reload();
}

 

  • March 17, 2010
  • Like
  • 0

Hi All,

 

Could anyone help me out, i am trying to create a button called "Assign To Me" for Cases.


So that i dont need to go into the "Edit" of a record to assign it to me.

 

This would be allot quicker.

 

Thanks in Advance

Jake Maskell