I'm trying to create an ImportMap object in CRM 4.0. I need to set the TargetEntity property which is a Picklist value. link text seems to imply that it can be done by using
importmap map = new importmap();
map.name = "test map";
map.targetentity = new Picklist();
map.targetentity.name = "Contact"
but this always seems to leave the target entity property as null.
Any thoughts?
Take this function to dynamic request picklist values:
If its a pick list, you will have to provide the index value. Assuming that you have an enum called TargetValues.Contact having value 1, then it would go like:
-- Edit --
I believe for what you are trying to achieve you will have to somehow retrieve the target entity and only then you will be able to enumerate them.
See this, probably this would help.
If above is of no use, then following is how you can do it:
But then somehow indices may change over a period of time, so in that case you can create an enumerated xml with those values/indices, and load them on runtime. But the problem with this approach is that:
Not-so-good approach, but running against a ticking deadline this is what you can do; this is never going to break or cause trouble. Just that xml loading part is not good.
Btw, if you would go through the CRM SDK, you will find the examples of similar sort.