Can lookups show other values than the primary key?

Answered Can lookups show other values than the primary key?

  • 15. februar 2009 10:16
     
     
    Hi there,

    I created a new entity called Country. This entity has two attributes in its form:
    • The primary attribute was renamed to ISO Code, which is the 2 letter code for the given country (e.g.: GB, BR, BE, etc)
    • Another attribute called Country Name was added, which is the name of the country in question (e.g.: Germany, France, Italy, etc)
    Suppose I add a many-to-one relationship in the Account entity for this new Country entity. In the lookup added in the form, the values that are displayed are by default the primary key (in this case, the ISO code for the country). Is there a way that I can instead show the Country Name (that is, not the primary key)?

    Thanks in advance for your help

    Regards,
    P.

Alle besvarelser

  • 15. februar 2009 11:19
     
     Svar
    Yes they can. You can use JavaScript to make a web service call to get another value and insert it as your lookup's crmForm.all.yourCountryEntityNameHere.DataValue[0].name value. The only problem is that if you change the referring record's full name it will not update it automatically, for that you would need to build a plugin to look for all records where it is used and change them.