You need to sign in to do that
Don't have an account?
Assign Account ID using URL
I have a custom object that is using record types. I am also using the Account Tabbed view.
In order to show one record type per tab on my account, I created a custom controller and used that to create my lists. I am trying to add a new button to each tab so users can create new records.
I am having a problem getting the account ID into the custom object. When I use the following, it assigns the accounts ID to the name field on the custom object. Trying to figure out how I correctly assign the account to the custom object.
Any help would be greatly appreciated!!! Thanks!!!!
public PageReference NewEnrollHealth() { Id Aid = ApexPages.currentPage().getParameters().get('id'); PageReference pageRef = new PageReference('https://cs3.salesforce.com/a01/e?CF00N700000021Lm4='+Aid+'&CF00N700000021Lm4_lkid=001Q000000EAALT'); return PageRef; }
If you're specifying a lookup field value in the URL, you have to specify two things: the Name of the looked up object, and the Id. But you're just specifying the Id (lkid = lookup Id, which you have hardcoded right now, and I don't think that's what you meant.
You're also filling in the Aid, which is the actual ID, into the name part of the field, and this is your problem. You need to get the actual Name of the Account if you're going to specify it in advance.
See how that works for you.
Good luck!
Jeremy
All Answers
If you're specifying a lookup field value in the URL, you have to specify two things: the Name of the looked up object, and the Id. But you're just specifying the Id (lkid = lookup Id, which you have hardcoded right now, and I don't think that's what you meant.
You're also filling in the Aid, which is the actual ID, into the name part of the field, and this is your problem. You need to get the actual Name of the Account if you're going to specify it in advance.
See how that works for you.
Good luck!
Jeremy
Jeremy, that is exactly what I needed!!! Thank you for taking the time to help me, I appreciate it!!!!!!
Fred