People then ask: how to show both active and inactive/deactivated records in the entity's Lookup View?
CRM MVP Batistuta Cai already had a post about a plug-in solution.
If the lookup entity is a system entity, you can also use this technique:
Let's start from an example: you have a custom entity call: MyEntity, you have setup a N:1 relationship between MyEntity and Opportunity, so the user can see an opportunity lookup field on the MyEntity form. Now you want to show users both active and inactive opportunities from that lookup field, all you need to do is put the below code into MyEntity.OnLoad() event:
crmForm.all.new_opportunityid.lookupclass = "alllookups";
The lookup class are controlled via xml files in %ProgramFiles%\Microsoft CRM\Server\ApplicationFiles\
If you take a look at the file: opportunity.xml, you may find a condition like: <condition attribute="statecode" operator="eq" value="0"/>
you can remove the condition, and then use this class, e.g: crmForm.all.new_opportunityid.lookupclass="opportunity"; However it's very much unsupported way(by changing files)! But if you open the file: alllookups.xml, you may find that the opportunity(object type="3") entity doesn't have such condition, so we can use this class to get all opportunities.
4 comments:
NICE! I've been looking for just this solution. thanks for sharing.
Hi Jim,
Once aqgain, great post. I am trying to edit the XML so that i can see both active and inactive records on the associated view for system and custom entities, any suggestions?
Thanks for your help
Joel
Great post, as always Jim! I was just about to tell a client this wasn't possible then I ran across this article while searching for something else. Thanks for the save!
Brilliant.
Post a Comment