function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Case assignment to a queue via API 6.0

I have developed a java code that allows Salesforce licensed user login to our external application using his Salesforce username and password and create a case via our internal web form (not using self serviced portal). When a user creates a case, it gets automatically assigned to him. I would like to change it and assigned the case to our case queue instead. I have the queue ID from group object, but I don't know how to use it with setOwnerId() method  Can you provide any example for doing this?

Thank you.


There are two ways to achieve your goal.

1) Pass the Case Queue Id (Group) in the create call in the OwnerId field. Cases and Leads both accept a Queue (Group) Id in the OwnerId field setOwnerId(groupId or userId).
2) Use the AssignmentRuleHeader on creates to have the record be dynamically assigned via Case Assignment Rules. This is a very handy way to allow an admin to begin to manage this aspect of Case routing. For instance, say you have a Case Origin picklist value for "Internal Web Form" and that is a hidden field value in your web form. Now your admin can create a Case Assignment Rule entry that says all Cases created with that value in that field should be assigned to the Queue. All you need to do is decide if you want to use the currently active rule or a separate rule that is not active. The API is very flexible in this way.

If you decide to go for option 2 you'll want to check out the following sections in the API doc:
Sforce Objects > AssignmentRule
Sforce Objects > Lead*
SOAP Header Options > AssignmentRuleHeader

* There is some sample code in the API docs in the Lead section but the concept is exactly the same for Case.

Quick Link to the online 6.0 API doc:

Good luck!

Message Edited by mtbclimber on 07-02-2005 03:30 PM