web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Related Virtual Entities and Invalid Argument error

(0) ShareShare
ReportReport
Posted on by
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):
0160.InvalidArgument.png
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.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    StefanS365 Profile Picture
    3,575 Most Valuable Professional on at

    Hi philmar,

    You could try the fix that is mentioned in the 'This step is important' section of the following blog post:

    dreamingincrm.com/.../using-virtual-entities-to-query-metadata

  • AP Hogeschool Profile Picture
    5 on at

    Hi Philmar

    I have got the same problem whith one-to-many relationship between two Virtual Entities.

    Did you find a solution?

    I will be grateful for any help you can provide.

    Best regards

    Peter

  • Krutika S Profile Picture
    20 on at

    Hi Peter,

    Have you got solution for this issue? I have 1:N relationship between two virtual entities and it gives me 'Invalid argument' error when I load a form. Tried various solutions but no luck so far.

    Best regards,

    Krutika

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans