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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer Service forum

RetrieveRecordChangeHistory return Object reference not set to an instance of an object

(0) ShareShare
ReportReport
Posted on by
When I am sending the request below, I keep getting Object reference not set to an instance of an object


https://***.api.crm4.dynamics.com/api/data/v9.0/RetrieveRecordChangeHistory(Target=@p1,PagingInfo=@tid)?@p1={'@odata.id':'incidents(002be138-e263-e811-a96a-000d3ab4cccd)'}&@tid={'Count':10,'PageNumber':1,'ReturnTotalRecordCount':true}
Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5iQ3dXMTF3M1hrQi14VWFYd0tSU0xqTUhHUSIsImtpZCI6Im5iQ3dXMTF3M1hrQi14VWFYd0tSU0xqTUhHUSJ9.eyJhdWQiOiJodHRwczovL2lrZWFzYS5jcm00LmR5bmFtaWNzLmNvbSIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzdkZGNkNDEyLWFhNjctNDIzZS1iNmQ3LThhOTBlZmJlZWViOS8iLCJpYXQiOjE1NDU1NjYzMTksIm5iZiI6MTU0NTU2NjMxOSwiZXhwIjoxNTQ1NTcwMjE5LCJhY3IiOiIxIiwiYWlvIjoiQVZRQXEvOEpBQUFBQVhESHBrNHFSbGM0MGhMSk9LOWl0MlZYOGsvM29HMzA5MENENklVVkYzSm5QMmJRSXVvcmVTanVWSW45b09PeVNlNEJ0VkV1RkFSWlpqY1BWTXhweUFocUJud21kbEx3ekg5RmhhUitPNVU9IiwiYW1yIjpbInB3ZCIsIm1mYSJdLCJhcHBpZCI6IjBlZDJkN2Q5LTE5ZWQtNGNiYy05MGRiLTk0OTMwZWY3MjYzMSIsImFwcGlkYWNyIjoiMCIsImZhbWlseV9uYW1lIjoiQUxUQUhIQU4iLCJnaXZlbl9uYW1lIjoiQUJEVUxXQURPVUQiLCJpcGFkZHIiOiIyMTIuMTIuMTg4LjI0NSIsIm5hbWUiOiJBQkRVTFdBRE9VRCBBTFRBSEhBTiIsIm9pZCI6IjZlZTIzYTdkLTMyYTEtNGU4Mi05ZWY2LWI5ZGYzNzE2Yjk4NCIsIm9ucHJlbV9zaWQiOiJTLTEtNS0yMS00MDE3NTQ0ODEtMTc0MjEyMTg3Mi00MjUxNzM2MjY3LTY1ODczMyIsInB1aWQiOiIxMDAzM0ZGRkE2MjIyQjYyIiwic2NwIjoidXNlcl9pbXBlcnNvbmF0aW9uIiwic3ViIjoieHIwRkRJdVVoMjVZcjdIQTd0NXZ3bE9zeW5xcVlrV0pJdHJwMXdqd0ZSWSIsInRpZCI6IjdkZGNkNDEyLWFhNjctNDIzZS1iNmQ3LThhOTBlZmJlZWViOSIsInVuaXF1ZV9uYW1lIjoiQTA3MTY3QGlrZWEuY29tLnNhIiwidXBuIjoiQTA3MTY3QGlrZWEuY29tLnNhIiwidXRpIjoiZVFUTEljOHRvVXVWSFFlN1VNSkJBQSIsInZlciI6IjEuMCIsIndpZHMiOlsiNDQzNjcxNjMtZWJhMS00NGMzLTk4YWYtZjU3ODc4NzlmOTZhIl19.DHMaJds_mzEfIYp03b-72IGgoxGrbQu7Dcjf9s_kd_XQjx2mn2uzria_EdTkW2Mltx32fBzzN4NJH41Ovm55wIKWT6iGMmACEeHsUb5j_ORY5orUpaBg0qEPjClAp37kN9tp9APfaw6_ju1FC8hYt2zliBqHr0E0GxJ8aPkI-1Xrpbk2zUrP5H5C3WiCkjDWrxgvADlkmvajo1Nq3Pvg86owPqWHy57t2s8wSjhmcTHTsCx1K63KatoRAMKiI2uKNeClZU6dnUHNw3x39m0fUvqJixI-vNi6mggZYyaXsfckQyPqCuNTx2BbQPVrs4yww43lVisXfb1T0DiQIAw3KA
Accept:application/json
OData-MaxVersion:4.0
OData-Version:4.0
Content-Type:application/json; charset=utf-8

Could any one please tell me what I am missing here?

Categories:
I have the same question (0)
  • Suggested answer
    LeoAlt Profile Picture
    16,341 Moderator on at

    Hi partner,

    Looks like you had missed a parameter named "AttributeLogicalName".

    community23.png

    According to the C# samples provided by Microsoft, this field should be the name of field you want to search for.

    community23.png

    You could add the right parameter ang try again.

    Hope it helps.

    Best Regards

    Leo

  • Community Member Profile Picture
    on at

    Thanks for your answer.

    This parameter is required for RetrieveAttributeChangeHistory , but I am trying to use RetrieveRecordChangeHistory which requires only 2 params as per below Link:

    docs.microsoft.com/.../retrieverecordchangehistory

  • LeoAlt Profile Picture
    16,341 Moderator on at

    Hi AWT,

    please try this code.

    function callwebapi
    {
        var req = new XMLHttpRequest();
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v9.0/" +
            "RetrieveRecordChangeHistory(Target=@p1,PagingInfo=@p2)?" +
            "@p1={'@odata.id':'" + EntityName + "(" + RecordId + ")'}&" +
            "@p2={'Count':10,'PageNumber':1,'ReturnTotalRecordCount':true}")
    
        req.onreadystatechange = function ()
        {
            if (this.readyState === 4)
            {            
                req.onreadystatechange = null;
                if (this.status === 200)
                {
                    var results = JSON.parse(this.response);
                }
                else
                {
                    Xrm.Utility.alertDialog(this.statusText);
                }
            }
        };    
        req.send(JSON.stringify({}));
    }

    Hope it helps.

    Best Regards

    Leo

  • Community Member Profile Picture
    on at

    I am still getting the same error, I have checked with different entities (contacts .ex) and different record IDs but always getting the same response. Also, I make sure the record I am sending in the request has actual audit history log.

    7120.Capture.PNG

  • Community Member Profile Picture
    on at

    I have got the same error message. Is the problem resolved?

  • ALTOSHAAM Profile Picture
    180 on at

    Same error for the Dynamics 365 9.0.15 on-premise.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans