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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Fetch cases from CRM

(1) ShareShare
ReportReport
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

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator 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

  • Verified answer
    Kumar R Profile Picture
    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.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans