locked
REST Query - RetrieveMultiple RRS feed

  • Question

  • Greetings,

    I was wondering if anyone could assist me with a query I need, here is the situation.

    I need to impersonate another user for the REST json query.

    Here is some more information on what I am trying to do if that helps:

    I have a custom entity that is linked to Account, the custom entity can only be linked to one account but the account can be linked to many records of the custom entity.

    Security is set up so each business unit can only see records created by users in the same business unit.

    I have a custom ribbon button on the account form that creates a new instance of the custom entity that is linked to the account.

    The problem I have is when a user clicks the create button on the Account form I need to check if another record of the custom entity exists and is active in the whole organization before I create another one. So what I need is using the rest query to check if any record exists connected to the account even if the user running the query does not have credentials to check for the data.

    Br,

    Halldor


    Halldór Jóhannsson

    Monday, January 27, 2014 1:17 PM

Answers

  • I had a similar issue a few months ago but had no luck in getting REST to return the data. I had to perform a system-wide count of records but users only had access to their own records - no matter which way I tried, the only way round it with REST was altering the user roles (which was not possible as we were dealing with personal information). The way that I got round it was to write an old-fashioned ASP page and put it on the CRM server.

    This ran an SQL query on the database which then put the count into a variable. The ASP then wrote some JavaScript which sent the output to parent.xrm.... and then I put the ASP in an iframe on the page. As long as you set up your connection string on the ASP page to have access to the database, this works fine. It's very old technology but it's very quick and it works.

    Monday, January 27, 2014 3:10 PM

All replies

  • I had a similar issue a few months ago but had no luck in getting REST to return the data. I had to perform a system-wide count of records but users only had access to their own records - no matter which way I tried, the only way round it with REST was altering the user roles (which was not possible as we were dealing with personal information). The way that I got round it was to write an old-fashioned ASP page and put it on the CRM server.

    This ran an SQL query on the database which then put the count into a variable. The ASP then wrote some JavaScript which sent the output to parent.xrm.... and then I put the ASP in an iframe on the page. As long as you set up your connection string on the ASP page to have access to the database, this works fine. It's very old technology but it's very quick and it works.

    Monday, January 27, 2014 3:10 PM
  • Greetings Jon_Evans and thank you for the response, I suspected I would have to do something like that to get this to work.

    Best regards,

    Halldor


    Halldór Jóhannsson

    Monday, January 27, 2014 3:25 PM