Working with Selection Lists

Supposing that there is a requirement that when a Company is of a particular type then when an Opportunity is created for that company there should be one set of options to put into the Oppo_type field.
You can see in the above screen shot of an Opportunity Summary screen that the Company is a 'Prospect' in which case the Opportunity types should be
  • 'Referral'
  • 'Recruitment'
  • 'License'
But if the Company type is 'Customer' then the Opportunity types should be
  • 'Software'
  • 'Services'
  • 'Mixed'
I could start with a single long list of Options like in the image below.
I could test to see what company type it was and then remove the unwanted options for example:

The code here would be placed in the onCreate script box of the oppo_type field in the OpportunityDetailBox screen.

[code language="javascript"]
if (CRM.GetContextInfo("Company","comp_type")=="Prospect")

But this could get unwieldy if there are a lot of options.

Instead, I can create a new sets of options in translations (custom_captions) and then 'swop' the new selection list into the field using the create script

[code language="javascript"]
if (CRM.GetContextInfo("Company","comp_type")=="Partner")
LookupFamily = "newoppo_type"

The hard work is the entry of the different Options allowed for the different Company types but the code becomes much simpler.