+ Start a Discussion
vgorgolvgorgol 

Using Custom Formula Hyperlink to open a non-case window

I have numerous examples of using a Custom Button containing a Link URL to open a new Case and pass info to the new case. We have even implemented this for cases. However, what I would like to do is to open a new custom object record and pass data to that. Is that possible? When I try, using the very basic link: /500/e?retURL=%2F500%2Fo&RecordType=01280000000LpIW I receive the following error message: Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. Which seems impossible given that I am running it as a Sys Admin. Does the link have to be structured differently for a custom object? Any help is appreciated.
Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells

Ok, then I suggest approaching it this way.  For example, if I'm trying to create a custom object record from a case (where case is the parent to the custom object), I would...

 

1) Go to case record.  Scroll down to custom object related list.  Use standard new button to create new custom object record

 

2) Copy URL for this new record.  For example:

https://cs2.salesforce.com/a0f/e?CF00NR00000013Gq3=00003500&CF00NR00000013Gq3_lkid=500R0000002d5w2&retURL=%2F500R0000002d5w2

 

3) Go to custom buttons for the custom object and paste above URL. Start substituting information:

/a0f/e?CF00NR00000013Gq3={!Case.CaseNumber}&CF00NR00000013Gq3_lkid={!Case.Id}&retURL=%2F{!Case.Id}

 

4) Add to the case page layout, test to make sure the basic URL works, then add functionality as needed.

 

All Answers

flewellsflewells

One thing you'll need to do is identify the 3-char ID for your custom object if what you're trying to do is create a new custom object record (instead of a case).  A low-tech way to determine the object ID is by going to the object's "home" tab and looking at the URL (if you don't have a tab for your object, then manually create a new record for that object and look at the URL).  You want  those three characters that appear after salesforce.com/ in the URL.  This will need to be substituted for "500" in your existing link because "500" is for Cases.  The IDs for some of the standard objects are:

 

Account -001

Contact - 003

Opportunity - 006

 

You'll also want to make sure that the record type ID you provide in your link relates to the record type of your custom object.

vgorgolvgorgol
I was wondering if it had something to do with the record id prefix, I just wasn't sure how the url needed to change. I will give that a try. Thank you!
vgorgolvgorgol
So, if the link for cases is: /500/e?retURL=%2F500%2Fo&RecordType=01280000000LpIW would the new link be (given that the new prefix is xxx) /xxx/e?retURL=%2Fxxx%2Fo&RecordType=01280000000LpIW Replacing both 500s, or just the first? I am thinking just the first, but thought I would make sure.
flewellsflewells

It's difficult to say without a better understanding where you're starting from and what kind of record you want to create.  If you are creating a new custom object record starting from that same custom object's tab, then...

 

/xxx/e?retURL=%2Fxxx%2Fo&RecordType=01280000000LpIW

 

 

If you are creating a custom object record from a new button on a different type of record, then...

 

/xxx/e?retURL=%2F{!RecordIdoftherecordyoustartedfrom}&RecordType=01280000000LpIW

vgorgolvgorgol

That seems to resolve most of my issues, thank you!

 

The only remaining piece seems to be a common issue amongst begineers, passing data into a lookup.

 

I am attemtping to pass account into a custom lookup, and am using the _lkid hack as suggested many places in this forum:

 

/a0k/e?retURL=%2F500%2Fo&RecordType=01280000000LpIX&{!LEFT($Setup.VPM__c.Industry_Vertical_Field_Id__c,15)}={!Account.Industry}&00N80000004dAHQ_lkid={!Account.Id}&00N80000004dAHQ={!Account.Name}

 

The resulting URL has the data:

 

https://tapp0.salesforce.com/a0k/e?retURL=%2F500%2Fo&RecordType=01280000000LpIX&00N80000004dAIA=&00N80000004dAHQ_lkid=001T000000VyhgA&00N80000004dAHQ=Bobsaccount2

 

The problem is the account isn't being populated into the lookup.

 

What am I doing wrong?

flewellsflewells

Is it safe to assume that 00N80000004dAHQ is the id for the custom field on your new record where you want the Account Name to be entered?

 

If yes, maybe try switching the order so that Account Name parameter is before the lookup parameter...


/a0k/e?00N80000004dAHQ={!Account.Name}&00N80000004dAHQ_lkid={!Account.Id}&retURL=%2F500%2Fo&RecordType=01280000000LpIX&{!LEFT($Setup.VPM__c.Industry_Vertical_Field_Id__c,15)}={!Account.Industry}

vgorgolvgorgol

Yes,  00N80000004dAHQ is the id of the master detail lookup field on the custom object.

 

Hmmmm... nope, that doesn't seem to work either.

 

The other field I am passing forward does work however, its the !Account.Industry.

 

Very strange.

flewellsflewells

Ok, then I suggest approaching it this way.  For example, if I'm trying to create a custom object record from a case (where case is the parent to the custom object), I would...

 

1) Go to case record.  Scroll down to custom object related list.  Use standard new button to create new custom object record

 

2) Copy URL for this new record.  For example:

https://cs2.salesforce.com/a0f/e?CF00NR00000013Gq3=00003500&CF00NR00000013Gq3_lkid=500R0000002d5w2&retURL=%2F500R0000002d5w2

 

3) Go to custom buttons for the custom object and paste above URL. Start substituting information:

/a0f/e?CF00NR00000013Gq3={!Case.CaseNumber}&CF00NR00000013Gq3_lkid={!Case.Id}&retURL=%2F{!Case.Id}

 

4) Add to the case page layout, test to make sure the basic URL works, then add functionality as needed.

 

This was selected as the best answer
vgorgolvgorgol

Ah! I like that methodology.

 

You know what the issue was? I needed to place CF in front of the field id.  When I built it from scratch, I neglected that.

 

Thank you very much for your help!