Discussion:
How to set up filter for related entity in a lookup
(too old to reply)
Daniel Johnson, Jr.
2010-06-29 17:37:15 UTC
Permalink
We have customized the Account entity to include 1:N relationships
with Employees. How can we make sure, on the Service Case form, when
we look up an Account, that, when we subsequently do a look up on
Employees, it filters just to the Employees of that Account?

Daniel Johnson, Jr.
Cincinnati, Ohio
Jarrett
2010-06-30 03:06:02 UTC
Permalink
Hi Daniel,

Paste this onload of the entity that has the look up for employess.
Replace "field" with the name of the employee lookup id.

if (crmForm.FormType == 2 && crmForm.ObjectId != null)
{

var name = crmForm.all.name.DataValue;

crmForm.all.field.additionalparams = 'search=' +
name.replace("&","%26").replace("+","%2b");
}

Hope this helps

Jarrett Coleman
http://jarrettexpertcrm.com
Daniel Johnson, Jr.
2010-06-30 20:47:39 UTC
Permalink
Post by Jarrett
Hi Daniel,
Paste this onload of the entity that has the look up for employess.
Replace "field" with the name of the employee lookup id.
if (crmForm.FormType == 2 && crmForm.ObjectId != null)
{
var name = crmForm.all.name.DataValue;
crmForm.all.field.additionalparams =  'search=' +
name.replace("&","%26").replace("+","%2b");
}
Hope this helps
Jarrett Colemanhttp://jarrettexpertcrm.com
Our Case form has a lookup attribute for Accounts and a lookup
attribute for Employees. A 1:N relationship exists between Account and
Employees.
When we open a new Case, look up an Account and select it.
We then lookup Employees and want to only see Employees of that
Account.

Help me unpack the code you've included...

It would appear that the event should be in the OnChange of the
Account attribute on the Case form, but you're saying it should go in
the OnLoad event of the form itself?

Thanks!

Daniel Johnson Jr

Loading...