Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Fetch cases from CRM

Posted on by

Hi All,

Portal user will be tagged with multiple accounts as a "Primary Contact". We need to retrieve all cases which are associated with each accounts where portal user set as a "Primary Contact" and display in Portal. 
We have tried to achieve it with FetchXML filter criteria, but how we will pass the portal user id dynamically to FetchXML query from portal to CRM?

Can any one help us to sort out the requirement.

*This post is locked for comments

  • Verified answer
    Kumar R Profile Picture
    Kumar R on at
    RE: Fetch cases from CRM

    Thanks Ravi for your reply. We have tried the contact lookup field approach before raising a query in forums, want to know the approach to build a custom logic and fetch the list of accounts by using portal user. I got the answer.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Fetch cases from CRM

    Hi ,

    You can use "user.contactid" in the fetch xml something like this-

    ------------------------------------------

    {% fetchxml entitltment_query %}
            <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" aggregate="true">
                <entity name="entitlement">
                    <attribute name='remainingterms' alias='remainingterms_sum' aggregate='sum' />
                    <filter type="and">
                        <condition attribute="contactid" operator="eq" value="{{ user.contactid }}" />
                        <condition attribute="statecode" operator="eq" value="1" />
                    </filter>
                </entity>
            </fetch>
          {% endfetchxml %}

    ------------------------------------------

    You could also achieve this by creating a contact lookup field on case entity say "Customer's Primary Contact" and auto populate it with customer's primary contact and then creating entity permission to get all cases this lookup relationship. This way you don't need to write/ customize the page with fetch xml.  I tried this and it worked fine-

    Portal-customer-cases.png

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans