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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

How to remove the current case from the results retrieved by Web API

(0) ShareShare
ReportReport
Posted on by 77

Hi, 

I am working on showing sibling cases whose parent is same by retrieving the child cases based on parent case using WebAPI retrieve where I would like to remove the current case from the list of results returned.

For example: Lets say...I have

Parent Case ABC got three child cases Test1, Test2 and Test 3.

If I am on Test 2 case, I would like to see...Test1 and Test3 cases as sibling cases but not all three of them. At present, I am retrieving all the three cases based on parent case but I would like to remove the current case from the list returned. Could someone please suggest me is there any way to achieve this. Thanks

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I believe you have the id of the current incident and id of the parent case so the query should look like "Select cases where parent case id equals PARENTCASEID and case id is not equal Test2. Should be simple enough.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi D365Admin,

    As Andrew Butenko said, the request url should be like this: var url = [organization URI] + "/api/data/v9.2/incidents?$select=title&$filter=parentcaseid/incidentid eq " + parentCaseID + " and incidentid ne " + caseID;

    Here is my ajax request sample :

    function openUrl(executionContext) {
    var parentCaseID = "xxx";
    var caseID = "xxx";
    var url = "[organization URI]" + "/api/data/v9.2/incidents?$select=title&$filter=parentcaseid/incidentid eq " + parentCaseID + " and incidentid ne " + caseID;
    var request = new XMLHttpRequest();
    request.open("get", url , true);
    request.setRequestHeader("OData-MaxVersion", "4.0");
    request.setRequestHeader("OData-Version", "4.0");
    request.setRequestHeader("Accept", "application/json");
    request.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    request.onreadystatechange = function () {
    if (request.readyState === 4) {
    console.log(JSON.parse(request.responseText));
    }
    }
    request.send();
    }

  • D365Admin Profile Picture
    77 on at

    It worked. Thank you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 42

#2
11manish Profile Picture

11manish 21 Super User 2026 Season 2

#3
Travis South Profile Picture

Travis South 19

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans