You need to sign in to do that
Don't have an account?
ShaneJensen
Add Current User to Case Team
Hi All,
I would like to add a Button to the Case layout that allows a user to add themselves to the Case Team with one click. Is this possible? Following on Chatter is not an option.
Thanks,
Shane
but I tested the below code . It is not creating duplicates. so you can happily use this..
Try this below code. remove the alert after testing ....
{!REQUIRESCRIPT('/soap/ajax/27.0/connection.js')}
var rolename = "TTEST";
var qr = sforce.connection.query("SELECT Id,Name FROM CaseTeamRole where Name ='"+ rolename +"'");
var records = qr.getArray("records");
var rec = records[0];
var ct = new sforce.SObject("CaseTeamMember");
ct.MemberId = "{!$User.Id}";
ct.parentId="{!Case.Id}";
ct.TeamRoleID =rec.Id;
alert('Logged In User:'+ct.MemberId);
alert('Case ID:'+ct.parentId);
alert('TeamRoleID:'+ct.TeamRoleID);
var result = sforce.connection.create([ct]);
alert('Successfully Added to Case Team');
parent.window.location.reload();
Please dont forget to mark this as solution. if it works for you!
All Answers
For this you need to create a VF page, in this you can give the option to select user option.
And save this data in case team object. Please let me know if you have any query.
If this ans is solve you problem please accept this answer.
{!REQUIRESCRIPT('/soap/ajax/27.0/connection.js')}
var ct = new sforce.SObject("CaseTeamMember");
ct.MemberId = "Loggedin User ID";
ct.parentId="Case Id";
var result = sforce.connection.insert([ct]);
if(result[0].getBoolean("success")){
window.location = "/" + '{!Case.Id}';
alert('Team Member Added to the Case!');
}
Pass the Case ID and Logged In User ID for MemberID and ParentId.
Please mark this as Answer if it solves your problem.
ct.TeamRoleID="Enter ID from CaseTeamRole";
var result = sforce.connection.upsert("Id",[ct]);
but I tested the below code . It is not creating duplicates. so you can happily use this..
Try this below code. remove the alert after testing ....
{!REQUIRESCRIPT('/soap/ajax/27.0/connection.js')}
var rolename = "TTEST";
var qr = sforce.connection.query("SELECT Id,Name FROM CaseTeamRole where Name ='"+ rolename +"'");
var records = qr.getArray("records");
var rec = records[0];
var ct = new sforce.SObject("CaseTeamMember");
ct.MemberId = "{!$User.Id}";
ct.parentId="{!Case.Id}";
ct.TeamRoleID =rec.Id;
alert('Logged In User:'+ct.MemberId);
alert('Case ID:'+ct.parentId);
alert('TeamRoleID:'+ct.TeamRoleID);
var result = sforce.connection.create([ct]);
alert('Successfully Added to Case Team');
parent.window.location.reload();
Please dont forget to mark this as solution. if it works for you!