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
SYunkerSYunker 

Change Case owner via URL hack?

I'm trying to create a custom case button that will change the case owner. We have professional edition so code that utilizes API can't be used. I've found some solutions online but they all require API. 

 

Anyone have any suggestions? Thanks a million!!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
RpeeRpee

Assuming:

Queue Name: "Tier 2"

Queue ID: 00G600000010FUZ

 

The button might look like this:

 

/{!Case.Id}/a?retURL=%2F{!Case.Id}&save=1&newOwn=Tier+2&newOwn_lkid=00G600000010FUZ&saveURL=%2F{!Case.Id}

 

All Answers

skodisanaskodisana

Hi,

 

Why do not use Change Owner list button on the Case's home page.

 

Thanks,

Kodisana

SYunkerSYunker

Sorry, let me provide more details. We want a button that will reassign a case to a queue, and furthermore it would be nice to have several of the fields updated (I know how to do this part, so i omitted it). We could use the change case button, but then the user would have to type the queue name and save the change, rather than just having a single button that does the same thing.

 

Thanks

*werewolf**werewolf*

You do have workflow, right?  You can use a standard URL hack to hack some random custom field, and then use a workflow that triggers on that custom field being a certain value to set the owner and those other fields, and to set that custom field back to its original value.

SYunkerSYunker

No workflows in professional edition. goddamn salesforce. thanks for the suggestion though.

RpeeRpee

 

This will work for hard-coding a user or queue into the change owner page (what happens after you click "change"). Notice /a? instead of /e? Not perfect, but pretty decent way to do this without workflow. And even better than workflow, you can be dynamic with the queue you're changing to based on some parameter on the case if you built this in a HYPERLINK field instead of a button - but that's for another post.
/CaseID/a?retURL=%2FCaseID
&newOwn_lkid=User ID
&newOwn=User%Name
&saveURL=CaseID
Wanna get crazy, add a &save=1 into the url. 

 

SYunkerSYunker
Are any of those variables that I need to swap out with the ID of the queue that should be getting ownership of the case? I'm having trouble getting this to work so far. Thanks so much for the help!! Ive been banging my head on this one for a while... Thanks again
skodisanaskodisana

My Suggestion is that Use the Change Owner button and write a validation rule on case object, So that users will not select any other queue.

 

Thanks,

Kodisana

RpeeRpee

Assuming:

Queue Name: "Tier 2"

Queue ID: 00G600000010FUZ

 

The button might look like this:

 

/{!Case.Id}/a?retURL=%2F{!Case.Id}&save=1&newOwn=Tier+2&newOwn_lkid=00G600000010FUZ&saveURL=%2F{!Case.Id}

 

This was selected as the best answer
SYunkerSYunker

It worked! Rpee, my friend - you are a genius! :smileyvery-happy:

 

Oddly the one thing I thought I knew how to do isn't working (changing case status). I'm adding &cas11=Feedback to the end but its not updating status. Maybe it can't be done at the same time as changing case owner, as that same line works in one of my other buttons... 

 

Is it possible to change fields in the case at the same time with this button? I'm hoping to utilize some specific escalation rules that would be triggered by the field changes (in addition to the case owner change).

 

Thank you!!!!! 

RpeeRpee

The problem that you are running into is that /a? is a different request than /e?

 

What would have to happen is the following: 

 

/{!Case.Id}/e?save=1&cas11=Status&saveURL=%2F{!Case.Id}%2Fa%3Fsave=1%26newOwn=Queue%26newOwn_lkid=QueueID%26saveURL=%2F{!Case.Id}

 

I may have done the last part of that wrong, but the key is you have to make two requests in one click and the 2nd request has to be fully URL encoded (except "=" ) & - %26    ? - %3F

 

Good luck.

SYunkerSYunker

Thanks Rpee, I'll try to figure the rest out on my own :p Thanks for all the brain power, really appreciate the help.

SYunkerSYunker

That was it! No editing required outside of swapping in my specific IDs. You are a true gentleman and a scholar Rpee!! Huzzah!!

 

I'm going to name by children after you!

RpeeRpee

Nice. Glad it worked.

 

sdetweilsdetweil

very cool.. I am trying to do something similar, but over-ride the save button on edit of my custom object.

 

I can override edit, and point to your kind of content as the saveURL..

 

it does in fact chaneg the variable, but then 'stops' on the edit page..

 

when I press Save again, it DOES save, but then puts up and error

 

here is my edit button override

 

window.parent.location.href = "{!URLFOR($Action.Problem__c.Edit , Problem__c.Id ,
 [saveURL=URLFOR("/" &Problem__c.Id & "/e?00N30000006DgFN=0&retURL=" &"/" & Problem__c.Id & "/a?save=1&retURL=/" & Problem__c.Id), retURL=URLFOR("/" & Problem__c.Id) ] ,false) }"
}

 

when I press Save the first time, which changes the checkbox, the URL then becomes

https://na1.salesforce.com/a0O30000002K79X/e?00N30000006DgFN=0&retURL=%2Fa0O30000002K79X%2Fa%3Fsave%3D1&retURL=%2Fa0O30000002K79X&newid=a0O30000002K79X

and when I press save the url becomes

 

https://na1.salesforce.com/a0O30000002K79X/e?save=1

 

but that produces an error

Error: Invalid Data.
Review all error messages below to correct your data.
The page you submitted was invalid for your session. Please click Save again to confirm your change.

 

 

what am I missing to keep the pages processing without stopping?

 

sam

 

 

*werewolf**werewolf*

@sdetweil, I don't think this particular type of URL hack works anymore.  A better solution would be to make a custom button in the vein of this blog post (but that changes OwnerId instead of the Status field).

sdetweilsdetweil

this hack worked in november..

 

I don't want to change any existing standard field..   only a custom field on a custom object.

 

I need to change the field to cause a trigger to work.. so I need to intercept the 'save' operation.

 

see my trigger help question in this board a few messages up.

http://boards.developerforce.com/t5/General-Development/trigger-control-help-needed/td-p/247311

 

Sam

RpeeRpee

So there was an update half a year ago that made new SFDC orgs default a particular permission as ON instead of OFF. Existing orgs are uneffected, but any new trial or dev org after July 10 or so has this setting.

 

You need to submit a case with support to stop the "This page is invalid for your session" errors.

 

Disable Validate CSRF Token on GET

Please Disable the Org-Wide permission "Validate CSRF Token on GET" so that save=x will work in buttons and formulas.

 

Warning: This change was made to prevent cross-site scripting attacks and in order to generally tighten the security of the platform. Salesforce.com does not recommend making this change. But, for me, being able to do save=1 is worth the risk.

 

Also, Tier 1 support won't know what you're talking about. This needs to get escalated in order to work.

sdetweilsdetweil

Ok, got it.. understand the issue..

 

I was just able to think thru a tiny change to the trigger which eliminates needing this subclass Save approach..

 

Sam

*werewolf**werewolf*

Indeed, and as per my post to your other thread sdetweil, in general you (or anyone) should try to avoid this type of URL hack, particularly since it increasingly does not work.  Glad to hear you were able to get your trigger working.

Lynn GrandeLynn Grande
I am trying this but when the case edit page comes up the case owner is not correct, it is still me...what am I doing wrong?
I have a case create page with links to a page create with specific passed parameters, this is one example.

<a href="/500/e?retURL=/{!case.id}&RecordType=012E00000005wqE&cancelURL=/{!case.id}&ent=Case&cas5=Problem&cas28={!case.casenumber}&cas4_lkid={!case.account}&cas3_lkid={!case.contact}&CF00NE0000005DBMr_lkid={!case.atc_contact__c}&CF00NE0000005DBMr={!case.atc_contact__r.Name} &cas8=Low&cas21=1&cas11=Internal&cas14={!Case.Subject}&cas15={!Case.Description}&newOwn_lkid=00Gc0000000jOoE&newOwn=CA+Account+Verification" target="_self">CA Account Verification</a><br />

Any help appreciated....
ShwetzShwetz
Hi Lynn, I have the same use case as you. Were you able to figure out how to get the owner set to Queue with the custom url?
Lynn GrandeLynn Grande
I had to create a field on the page and then use assignment rules...assigning owner to value of field (which I passed in on URL). Not a good solution but it works. Thank you, Lynn Grande Coastal Cloud/Infinitive "Live at the beach. work in the cloud" ™ (508) 341-3258