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
AddaAdda 

Salesforce URL hacking on Case Feed Lookup

Hi, 

I have a unqiue problem. We are using Case Feed. When the account and contact is update on case we need a functionality to automate. Whenever a account is selected on lookup and user goes to contact lookup and if they don't find the contact they create a new contact. But nothing is prepopulated from account to contact. So, I am creating a formula field and making it available on lookup dialog. 

But the problem is I want to prepopulate some of the field like account name, account id into the new contact record using the formula as a URL hack. But I am not able to get the formula right. This is what I came up with.

HYPERLINK("https://cs30.salesforce.com/003/e?retURL=%%F001%2Fo&accid=Case.AccountId", "Create a Contact")

Please help. I am sorry I don't make this requirement understandable.

Thanks
Adda
SlashApex (Luis Luciani)SlashApex (Luis Luciani)
Hi Adda,

You are in the right track! I made a few corrections and hopefully this will work:

HYPERLINK("/003/e?retURL=/"+Case.Id+"&accid="+Case.AccountId, "Create a Contact")

Modifications:

1. Removed the "https://cs30.salesforce.com" and made the URL a relative URL. It is not a good idea to hard code the base url (https://cs30.salesforce.com) since this can change in the future. Also it will be different in your sandboxes vs prod.

2. retURL defines the URL you want to return to. I assumed you would prefer to return to the Case. If that is not the case, then just remove the retURL parameter.

3. Notice how I am building a string by adding different pieces (in bold). The formula needs to evaluate what the actual Account ID is and insert that, before it was just passing the words "Case.AccountId". 

Hope this helps!
AddaAdda
Hi Luis,

Error: Invalid Data. 
Review all error messages below to correct your data.
Field Case does not exist. Check spelling. (Related field: Formula)

Just want to make sure you understand. I am creating the formula on Contact object for Case to be added in the lookup dialog. So, anytime lookup is opened from the case the this formula will show up and pass on few parameter from account to contact to case.

Can you pls review the error?
AddaAdda

Hi Luis do you have any idea on this problem.

I need to create a button that whenever a contact is created from case automatically the case should be attached in the contact as a related list. So far I can came upto this but I am not able to pass the value from case to contact. Please help.

https://cs30.salesforce.com/003/e?retURL=%2F003n0000006N1WG&con4={!Case.Account}&con10={!Account.Phone}&{!Case.ContactId}={!Case.Id}&RecordType=012n00000008Wq0&ent=Case
SlashApex (Luis Luciani)SlashApex (Luis Luciani)
Hi Adda,

Here is what I am understanding:

1. You are on a Case that already exists
2. You click a button that will take you to a "New Contact" page
3. Once you save the contact, it redirects you to the Contact and the original case is related to the Contact already.

This is a rather tricky situation, because the button will redirect you to the Contact page and there is no way to map it to the case with a URL parameter like you were attempting. There is no Case field on the Contact, the relationship is the other way around (Case has a lookup to contact).

The only way to accomplish this would be by creating a custom JS button that will do the following:

- Create a dummy contact
- Update the case.contactID field to be equal to the new contact
- Redirect to the edit view of the contact you just created

This will work, except if for any reason the user then cancels from the contact edit page, the case will remain associated to the dummy contact.

Good luck!