Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Retrieve data from CRM to Portals

(0) ShareShare
ReportReport
Posted on by 10

Hi everyone.

I want to allow unauthenticated users to retrieve data from CRM, what is the most secure way to do that? I tried to use odata but the entity list is exposed so everyone can simply paste the URL in the browser and retrieve all the records from that entity. myPortal/.../myEntity.

The scenario is
- An unauthenticated user is redirected to our first portal web page, where we have 2 fields to be validated in CRM. The user populate those 2 fields and press submit, if the record exists in CRM we let the user proceed to the other screen.

Thanks

  • henriquepalomo338 Profile Picture
    10 on at
    RE: Retrieve data from CRM to Portals

    Thanks! yes, I did it already and it's working fine, I just forgot to post it here.

    It's not 100% secure but it's better than odata anyway.

    Thanks again.

  • Suggested answer
    Inogic Profile Picture
    502 on at
    RE: Retrieve data from CRM to Portals

    Hi,

    Instead of using the entity list and enabling odata, you can use the fetchXml directly on the web page which you going to show the anonymous user.
    Fetch XML can only be executed on load of the form through liquid code. So what you need to do is -On the click of the button add querystring on the url (field name and user provided value) and reload the form.

    Once the form is reloaded, the liquid code will be executed and it will check if all the query string keys are present. If yes, then it executes the fetchXML.

    Follow the below step:
    1. Go to the content page of web page.

    2. Write the below code on the Copy (HTML) field of a Web Page 
    {% if user and request.params.id %}
    {% fetchxml getSlots %}
    <fetch version="1.0" mapping = "logical" output - format="xml-platform" distinct = "false" >
    <entity name="nur_executeportalaction" >
    <attribute name="nur_executeportalactionid" > </attribute>
    < attribute name = "nur_name" > </attribute>
    < attribute name = "nur_result" > </attribute>
    < order descending = "false" attribute = "nur_name" > </order>
    < filter type = "and" >
    <condition value="{{request.params.id}}" attribute = "nur_parametersinjson" operator = "like" > </condition>
    < /filter>
    < /entity>
    < /fetch>
    {% endfetchxml %}
    {% endif %}

    3. Now write the script on click of the button as below.
    $(function () {
    window.history.pushstate(null,null,location.origin + location.pathname);
    $("#btnSubmit").on('click',function(){
    var origin = location.origin; var args = location.search;
    varpath = location.pathname;
    location = origin + path + args + ((args =="") ? '?' : '&' ) + 'id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
    });
    });

    4) Here you will add your logic as -if results.entities.size is greater than 0 then redirect the user to another page.

    Hope this helps!
    Thanks

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 106

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

Overall leaderboard

Product updates

Dynamics 365 release plans