custom case button

How to create a custom button, that will get the next Case in a queue and assign it to the current user. After the button is clicked it will display the case detail page, with the details of the case assigned to the current user

Hi, Eddie,
I’m working on getting a response for you. Let me ask, by the “next” Case in the queue, do you mean the first one, or would you like to be able to move through the list in order?

Just grab the next case, assign it to the current user, then display all the case details and related lists thanks

I’m sorry, I don’t think I made that question very clear. Do you mean just the case at the top of the queue?

Yes, thanks

Ok, I just realized that you may be talking about Queues in Salesforce (allowing cases to be assigned to a group of people) rather than the Skuid Queue component. Is that what you are referring to? In this case, you can do a custom button as a row action in a Cases table that assigns the case to the current user and redirects to that case’s page.

Here’s an example I did with a list of cases belonging to a given queue, with an “Assign to Me” button.

My models are CurrentUser, Group (which references the queue, “AllSupportReps” in this case).

My code for the “Assign to Me” snippet looks like this:

//Get the current user var currentUser = skuid.model.getModel('CurrentUser').getFirstRow(); //Get the cases model and the selected case from the row var casesModel = skuid.model.getModel('Cases'); var selectedCase = arguments[0].item.row; //Update the case's owner to the current user casesModel.updateRow(selectedCase, {OwnerId: currentUser.Id});; //Redirect to the case's page window.location = '/' + selectedCase.Id;

If this is not the solution you need, let me know and I will dig deeper and see if I can find what you’re looking for.

Hi Emily I have the following URL:

I am using a Global Action and creating an Attach a File to the Case. This is a redirect action

with regards to the retURL I have tried the following:

As I want the return url to be: /apex/skuid__ui?CaseId=50011000003AQptAAG&page=CaseDetailsModel

It works fine to have the return URL to contain CaseId={{$Param.CaseId}} OR page=CaseDetailsModel but I don’t know how to include both in the return URL.

I want to return the URL and have the correct page showing, would you know how to do this.

Thanks again


Also for the Save and Cancel buttons on standard pages.

i.e. If the user wishes to edit a case, then I have the skuid page redirect to the standard edit case page. Is there a way to redirect back to the original skuid page, after they click Save or Cancel on the standard salesforce page, thanks

Hey, Eddie,
For your file attachment redirect, try this:


I think the problem is that you were not using an encoded url for the return URL parameter. The retURL portion
is the encoded version of the url

Here’s a good reference for url encoding. But also, the easier option is to use a url encoder/decoder to do it for you! You can just copy/paste any url into the window.


Emily thats great, I was actually close as I had this:


But your example worked brilliantly, thanks as always.

Another question:
If I click in Skuid to Edit a case, and it goes to a Standard Salesforce Edit Case view. Once I click on the Save or Cancel button how to I make sure it redirects back to the CaseDetailsModel page like I am doing above with NoteAttach?

Thanks again

Glad that worked! For Edit Case, try this:


Uses the url address of the Edit Case page, but change the retURL to the same value as in the Attach File example. This works for the Save and Cancel buttons. However, it will not redirect back to your CaseDetailsModel page if the user clicks “Save and Close” from the Edit Case page (since the Save and Close page comes between the Edit Case page and your Skuid page. HOWEVER, if you override the standard Salesforce case detail page with your Skuid page, you should always be redirected back to the Skuid case detail page. This tutorial explains overrides further. If you choose to go that route, then your retURL for both of your pages (Attach and Edit) will simply be {{$Param.CaseId}}, and it will return to your Skuid page!

Eddie, you only need to post your question in one place, we’ll answer it wherever you post it.