Hi all,
I have another Virtual Entity issue.
I have a single custom entity provider that is returning multiple types of virtual entities. Since they are all coming from the same provider, I can use the same data source for all of them.
I have one virtual entity (TerminalCard) that references another virtual entity (Terminal). The field is defined in CRM as a lookup on the entity to the other.
So each TerminalCard references one Terminal, but a Terminal can be referenced by multiple TerminalCards.
In my custom provider, I am setting the Terminal ID field of the TerminalCard to the ID of the Terminal that it references, making sure that it's a GUID. I think that I have set up the external names correctly: the external name of the TerminalCard field for the TerminalID is the same as the external name of the ID for Terminal:
So I have something like:
Terminal ID field:
Name: new_terminalid
External Name: new_terminalid
TerminalCard lookup field:
Name: new_terminalid
External Name: new_terminalid
I can retrieve Terminals without a problem (using Advanced Find, for instance). When I try to retrieve TerminalCards, I get an 'Invalid Argument' error, and no log file to download (so I can't actually see what's wrong):
I know one common cause of this is when two virtual entities are coming from different data sources; but I'm very confident that they are coming from the same data source, since I only have one. (Side note: I initially didn't realize you could have more than one entity returned from a data provider, so I had two. I wasn't even allowed to set up the relationship because of this, which is why I think I'm good here).
I see that my plug-in is called in the Plug In Trace log, and I see no exceptions. Note that only the TerminalCards retrieve is called before the error; I don't see the Terminal call.
Note that if I remove the relationship (for example, just making the ID a string field), I'm able to retrieve the TerminalCards, and the ID value is set to the correct TerminalID. The error only happens when the relationship is present (which I really need for filtering).
So I have several questions;
- In the call to retrieve the TerminalCards, I'm only returning the TerminalCards; I'm not building Terminal entities and attaching them. Do I need to do this?
- Is there any way to get more details about the error?
- Are there any examples of custom data providers with related virtual entities? I've seen examples using the OData provider, but I'm not using that.
Any other tips or ideas are appreciated - thanks.