+ Start a Discussion
DeptonDepton 

custom button- look up issues

 

Hi,

 

I have created this custom button on Contracts (custom object)

 

/a06/e?CF00N30000007eLJc={Account.Name}&CF00N30000007eLJc_lkid={Account.id}&
00N30000007eKjn={!Account.Calle_facturacion__c}&
00N30000007eKjs={!Account.Ciudad_Facturacion__c}&
00N30000007eKkH={{!Account.Pais_facturacion__c}}&
00N30000007eKkM={!Account.Estado_Provincia_facturacion__c}&
00N30000007eKkR={!Account.Codigo_Postal_facturacion__c}&
retURL=/{!Account.Id}

 

I go to an Account records and from there I create a new "Contract"  not the standard object  but a custom one....

 

When I click on the "NEW"  custom button all the fields are populated except the 2 look up fields:

 

00N30000007eKkM={!Account.Estado_Provincia_facturacion__c}&

00N30000007eKkH={{!Account.Pais_facturacion__c}}

 

these ID´S are the "Contract" fields I want to prepopulate with the Account ones.

 

The question is why are all the text fields prepopulated correctly? For instance:

 

00N30000007eKjn={!Account.Calle_facturacion__c}&

00N30000007eKjs={!Account.Ciudad_Facturacion__c}

 

 

And why are the 2 look ups left blank?

The Accounts look up were filtered but I have deleted these filters!! I have also tried tried with quotes and with the account field ID without success

 

00N30000007eKjs="{!Account.Ciudad_Facturacion__c}"

00N30000007eKjs={!Account.Ciudad_Facturacionid__c}"

 

 

nothing!! :(

 

Any ideas!?

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
DeptonDepton

Got It!!!!

 

 

retURL=/{!Account.Id}

/a06/e?CF00N30000007eLJc={!Account.Name}&CF00N30000007eLJc_lkid={!Account.Id}&
00N30000007eKjn={!Account.Calle_facturacion__c}&
00N30000007eKjs={!Account.Ciudad_Facturacion__c}&
CF00N30000007eKkH={!Account.Pais_facturacion__c}&
CF00N30000007eKkH_lkid={!Account.Pais_facturacionId__c}&
CF00N30000007eKkM={!Account.Estado_Provincia_facturacion__c}&
CF00N30000007eKkM_lkid={!Account.Estado_Provincia_facturacionId__c}&
00N30000007eKkR={!Account.Codigo_Postal_facturacion__c}&

retURL=/{!Account.Id}

 

 

Need to put CF before any look up field & for the _lkid need to use the look up ID field.

 

:))))

 

Thanks Ankit!!!

All Answers

Ankit AroraAnkit Arora

Not sure though, but worth giving a shot. When you want to fill the lookup reference using the URL parameter then you need to fill two values for lookup ids

 

1) Name of the object record in Id

2) Id of the object record in Id_lkid

 

Like you have already done for the first one 

 

"e?CF00N30000007eLJc={Account.Name}&CF00N30000007eLJc_lkid={Account.id}"

 

Now if you want to fill the other two lookup reference then you should fill the id in lkid for them

 

00N30000007eKjs={!Account.Ciudad_Facturacion__c}&

00N30000007eKjs_lkid={!Account.Ciudad_Facturacion__c.Id}&

00N30000007eKjn={!Account.Calle_facturacion__c}&

00N30000007eKjn_lkid={!Account.Calle_facturacion__c.id}

 

In above I have just explained you how to do this but you need to figure out what exactly are the lkids for the lookup reference and what ids are to be filled in them.

 

P.S : You can find out the lkids and ids of reference fields in view source.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

DeptonDepton
<tr><td class="labelCol requiredInput"><label for="CF00N30000007eKkM"><span class="requiredMark">*</span>Provincia facturación</label></td><td class="dataCol col02"><div class="requiredInput"><div class="requiredBlock"></div><input type="hidden" name="CF00N30000007eKkM_lkid" id="CF00N30000007eKkM_lkid" value="000000000000000" /><input type="hidden" name="CF00N30000007eKkM_lkold" id="CF00N30000007eKkM_lkold" value="null" /><input type="hidden" name="CF00N30000007eKkM_lktp" id="CF00N30000007eKkM_lktp" value="a08" /><input type="hidden" name="CF00N30000007eKkM_lspf" id="CF00N30000007eKkM_lspf" value="0" /><input type="hidden" name="CF00N30000007eKkM_lspfsub" id="CF00N30000007eKkM_lspfsub" value="0" /><input type="hidden" name="CF00N30000007eKkM_mod" id="CF00N30000007eKkM_mod" value="0" /><span class="lookupInput"><input  autocomplete="off" id="CF00N30000007eKkM" maxlength="255" name="CF00N30000007eKkM" onchange="getElementByIdCS('CF00N30000007eKkM_lkid').value='';getElementByIdCS('CF00N30000007eKkM_mod').value='1';" size="20" tabindex="15" type="text" /><a href="javascript&colon;%20openLookup%28%27%2F_ui%2Fcommon%2Fdata%2FLookupPage%3Flkfm%3DeditPage%26lknm%3DCF00N30000007eKkM%26lktp%3D%27%20%2B%20getElementByIdCS%28%27CF00N30000007eKkM_lktp%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27CF00N30000007eKkM%27%29.value.substring%280%2C%2080%29%29%29" id="CF00N30000007eKkM_lkwgt" onclick="setLastMousePosition(event)" tabindex="15" title="Provincia facturación Lookup (New Window)"><img src="/s.gif" alt="Provincia facturación Lookup (New Window)"  class="lookupIcon" onblur="this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Provincia facturación Lookup (New Window)"/></a></span></div></td><td class="labelCol"><label for="CF00N30000007eKkq">Provincia envío</label></td><td class="dataCol"><input type="hidden" name="CF00N30000007eKkq_lkid" id="CF00N30000007eKkq_lkid" value="000000000000000" /><input type="hidden" name="CF00N30000007eKkq_lkold" id="CF00N30000007eKkq_lkold" value="null" /><input type="hidden" name="CF00N30000007eKkq_lktp" id="CF00N30000007eKkq_lktp" value="a08" /><input type="hidden" name="CF00N30000007eKkq_lspf" id="CF00N30000007eKkq_lspf" value="0" /><input type="hidden" name="CF00N30000007eKkq_lspfsub" id="CF00N30000007eKkq_lspfsub" value="0" /><input type="hidden" name="CF00N30000007eKkq_mod" id="CF00N30000007eKkq_mod" value="0" /><span class="lookupInput"><input  autocomplete="off" id="CF00N30000007eKkq" maxlength="255" name="CF00N30000007eKkq" 

 

Thank you Ankit!!

You are right and I know i need to add the lkid but cannot find that info in this source??

 

 

00N30000007eKkH="Pais_facturacion__c"& 

00N30000007eKkH_lkid="????" 

 

Account.Pais_facturacion__c (id: 00N30000007eK3u) is a custom look up that looks at the Pais object:

 

object API name: Pa_s__c    

object id: 01I30000001r182

 

Any other ideas?

Thank you.

 

 

Ankit AroraAnkit Arora

If "Pais_facturacion__c" is a lookup field then you need to so something like this :

 

00N30000007eKkH="Pais_facturacion__c.Name"&

00N30000007eKkH_lkid="Pais_facturacion__c" 

 

Let me know if it is not clear to you.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

DeptonDepton

Got It!!!!

 

 

retURL=/{!Account.Id}

/a06/e?CF00N30000007eLJc={!Account.Name}&CF00N30000007eLJc_lkid={!Account.Id}&
00N30000007eKjn={!Account.Calle_facturacion__c}&
00N30000007eKjs={!Account.Ciudad_Facturacion__c}&
CF00N30000007eKkH={!Account.Pais_facturacion__c}&
CF00N30000007eKkH_lkid={!Account.Pais_facturacionId__c}&
CF00N30000007eKkM={!Account.Estado_Provincia_facturacion__c}&
CF00N30000007eKkM_lkid={!Account.Estado_Provincia_facturacionId__c}&
00N30000007eKkR={!Account.Codigo_Postal_facturacion__c}&

retURL=/{!Account.Id}

 

 

Need to put CF before any look up field & for the _lkid need to use the look up ID field.

 

:))))

 

Thanks Ankit!!!

This was selected as the best answer
LauraJMLauraJM

This looks like everything you are pulling is from the same object - the Account page. 

 

I have tried using the CF and the _lkid but for the life of me I can't figure out how to pull the Quote Lookup from the Quote Line Item to this new custom object :(

DeptonDepton

If you want to populate the field called "Hello" in the "New object" with

a field from the quote line item called "Laura"

 

And "Hello"  ID is 00001111

 

Then your code should look like:

 

 CF00001111_lkid={!Quote .Quotelineitem.lauraId}&

 

 

LauraJMLauraJM

I'm doing that ...

 

https://na8.salesforce.com/a1O/e?
CF00NC00000052E9C={!Quote.QuoteNumber}&
CF00NC00000052E9C_lkid={!Quote.Id}

 

but it won't work. 

 

I can pull from the Quote Line Item object okay, but it won't let me reach to the Quote object.  But I have done something similar with a Contact and looked up to the Account. 

DeptonDepton

Hi Laura,

 

Should be something like:

 

CF00N30000007eKkH={!Quote.QuoteNumber__c}& 

 CF00N30000007eKkH_lkid={!Quote.QuoteNumberid__c}&

as i said:

 

00N30000007eKkH this one is the field you want to prepopulate 

Quote.QuoteNumber  is the field you are taking the info from

 

First line CF + ID of the field you want to populate = Look up  field name you take the info from {!Quote.QuoteNumber__c}

 

Second line CF + ID  + _lkid =  the look up field ID of the field ={!Quote.QuoteNumberid__c}

 

let me know if you  have any issues


:))