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
ricky88ricky88 

Populated Person Account's field via Custom Button produced "Error: No matches Found"

 

I created a custom button (Create New Invoice) with the sample code below:
After clicking the custom button, i reach the desired page where the Accounts field is populated with the Person Account's name from the object where the custom button was originally placed. 
However, despite the name being correct, the error shows "Error: No matches Found".
I clicked on the magnifying glass and could select the same name from the lookup dialog box search result, which later on removed the error.
Screenshot with error resolved despite being the same name: 
-----
Example, if the Account.name is "Ricky Test", when i click on the custom button, it will populate "Ricky Test" in the desired page but the error shows "Error: No matches Found".
I have to then click on the magnifying glass and select the same name "Ricky Test" from the  lookup dialog box search result which then removes the error. 
It was the same name. How do i make sure the error doesn't occur in the first place?

 

Best Answer chosen by Admin (Salesforce Developers) 
marioluisscmarioluissc

Hi,

 

In layout for Lookup fields there are other hidden fields and they must to be populates.

For this, you have discovery the "Id" field in HTML, and add this parameter in your URL.

 

for sample:

 1 field lookup in layout create other hidden fields:

 

Correct URL is :  https://ap1.salesforce.com/a0X/e?CF00N90000001jEEE={!Account.Name}&CF00N80000004C5MB_lkid={Account.Id}&retURL=/a0X/o

<input name="CF00N80000004C5MB_lkid" id="CF00N80000004C5MB_lkid" value="000000000000000" type="hidden">
<input name="CF00N80000004C5MB_lkold" id="CF00N80000004C5MB_lkold" value="null" type="hidden">
<input name="CF00N80000004C5MB_lktp" id="CF00N80000004C5MB_lktp" value="500" type="hidden">
<input name="CF00N80000004C5MB_lspf" id="CF00N80000004C5MB_lspf" value="0" type="hidden">
<input name="CF00N80000004C5MB_lspfsub" id="CF00N80000004C5MB_lspfsub" value="0" type="hidden">
<input name="CF00N80000004C5MB_mod" id="CF00N80000004C5MB_mod" value="0" type="hidden">

<input id="CF00N80000004C5MB" maxlength="255" name="CF00N80000004C5MB" onchange="getElementByIdCS('CF00N80000004C5MB_lkid').value='';getElementByIdCS('CF00N80000004C5MB_mod').value='1';" size="20" tabindex="3" type="text"><a href="javascript&colon;%20openLookup%28%27%2F_ui%2Fcommon%2Fdata%2FLookupPage%3Flkfm%3DeditPage%26lknm%3DCF00N80000004C5MB%26lktp%3D%27%20%2B%20getElementByIdCS%28%27CF00N80000004C5MB_lktp%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27CF00N80000004C5MB%27%29.value.substring%280%2C%2080%29%29%29" id="CF00N80000004C5MB_lkwgt" onclick="setLastMousePosition(event)" tabindex="3" title="Caso Pesquisar (nova janela)"><img src="/s.gif" alt="Caso Pesquisar (nova janela)" 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="Caso Pesquisar (nova janela)">

All Answers

marioluisscmarioluissc

Hi,

 

In layout for Lookup fields there are other hidden fields and they must to be populates.

For this, you have discovery the "Id" field in HTML, and add this parameter in your URL.

 

for sample:

 1 field lookup in layout create other hidden fields:

 

Correct URL is :  https://ap1.salesforce.com/a0X/e?CF00N90000001jEEE={!Account.Name}&CF00N80000004C5MB_lkid={Account.Id}&retURL=/a0X/o

<input name="CF00N80000004C5MB_lkid" id="CF00N80000004C5MB_lkid" value="000000000000000" type="hidden">
<input name="CF00N80000004C5MB_lkold" id="CF00N80000004C5MB_lkold" value="null" type="hidden">
<input name="CF00N80000004C5MB_lktp" id="CF00N80000004C5MB_lktp" value="500" type="hidden">
<input name="CF00N80000004C5MB_lspf" id="CF00N80000004C5MB_lspf" value="0" type="hidden">
<input name="CF00N80000004C5MB_lspfsub" id="CF00N80000004C5MB_lspfsub" value="0" type="hidden">
<input name="CF00N80000004C5MB_mod" id="CF00N80000004C5MB_mod" value="0" type="hidden">

<input id="CF00N80000004C5MB" maxlength="255" name="CF00N80000004C5MB" onchange="getElementByIdCS('CF00N80000004C5MB_lkid').value='';getElementByIdCS('CF00N80000004C5MB_mod').value='1';" size="20" tabindex="3" type="text"><a href="javascript&colon;%20openLookup%28%27%2F_ui%2Fcommon%2Fdata%2FLookupPage%3Flkfm%3DeditPage%26lknm%3DCF00N80000004C5MB%26lktp%3D%27%20%2B%20getElementByIdCS%28%27CF00N80000004C5MB_lktp%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27CF00N80000004C5MB%27%29.value.substring%280%2C%2080%29%29%29" id="CF00N80000004C5MB_lkwgt" onclick="setLastMousePosition(event)" tabindex="3" title="Caso Pesquisar (nova janela)"><img src="/s.gif" alt="Caso Pesquisar (nova janela)" 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="Caso Pesquisar (nova janela)">
This was selected as the best answer
ricky88ricky88

Hi Mario,

 

Your solution works.

 

My end link was https://ap1.salesforce.com/a0X/e?CF00N90000001jEEE={!Account.Name}&CF00N90000001jEEE_lkid={Account.Id}&retURL=/a0X/o.

 

Thank you very much for your insight.

 

5 thumbs up for you!!!

 

=))))))