Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Retrieve records (count) which are deactivated in specified month

Posted on by 130

Hi , 

In which way I can retrieve records which are deactivated month wise ?

One batch job is there which updates all the active & inactive records daily through SDK call. So all the active/inactive records are getting modified daily. So I can not use Modified On filter to retrieve the required list.

Thank you...

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve records (count) which are deactivated in specified month

    From what I have understood, you are not able to track the date at which status field is changed to "Inactive" (since modified date shows todays date always).

    So all you can do is write a workflow for setting the "Status Change Date" to the date in which status is changed to "Inactive".

    This can be done like this.

    execution1.png

    • Put the IF CONDITION as "status equals Inactive"
    • In the action part, choose "Update Record" option
      Click on "Set Properties"

      execution1.png

    • Choose the "Status Change Date Field"( as an example I have chosen the "Last On hold time" field in the image shown).
      For setting it to the date in which record status is changed to "Inactivate" , choose the "Lookfor" as --> process --> execution (Just like in the image). Click on "Add".
    • You will now see the value set to the field (the one in yellow color)

      Activate the workflow for setting this field each time your status is changed to "Inactive". Now you can track the dates in which the status is changed to "Inactive".

      This will work for all your future records. Since you don't have the correct "Modified on" field for your older records, I don't think you can track the status change dates for the older records(as each time the "Modified on " field was modified by your batch process, you must have lost the date value in the modified on field).

      Hope I had answered your query :)
      Thank you  
       
  • Sateesh123 Profile Picture
    Sateesh123 130 on at
    RE: Retrieve records (count) which are deactivated in specified month

    Yes. I need that deactivated dates and next I need to query on those dates to retrieve inactive records count month wise. But how ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve records (count) which are deactivated in specified month

    So, basically you are not able to track the date in which the status is changed to "Inactive" ?

  • Sateesh123 Profile Picture
    Sateesh123 130 on at
    RE: Retrieve records (count) which are deactivated in specified month

    In my case, Modified On date is not same as Deactivated Date because the batch job runs on all the records. So, Modified On Date shows today's date, but record's deactivation date is some old date for ex: 6/27/2014 (from audit history)

    07447.Capture.JPG

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve records (count) which are deactivated in specified month

    Hello Sateesh,

    For that you may need to "bulk edit" field value. Since "Status Change date"  field is not set for your older records, you may need to go for bulk editing this field value for the older records. That is, set the "Status Change date" field with "Modified On" field value.

    It might be difficult for you to manually edit all the values for previous records. So I have found a link that clearly shows different options for bulk editing with screenshot images. Do check with it and choose the one that you find easy to go with.

    iancrm.wordpress.com/.../microsoft-dynamics-crm-and-bulk-editing-records

    Remember, "Activate" the workflow ( the one we discussed above) only after the bulk editing process gets completed. You will now be able to apply the workflow on the older records as well.

    Hope this helps :)

    Please do verify if you find it helpful:)

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: Retrieve records (count) which are deactivated in specified month

    Fot the existing records, you will have to choose one of the following options, based on how many records you have in inactive state already:

    Option 1: Create a real time workflow (Suitable for upto 5000 records, run the workflow 20 times {20*250=5000})

    You need to create an on-demand workflow and update fields like

    Actiavted/Deactivated by= Modified by

    Actiavted/deactivated on=Process (Execution time)

    6445.2.PNG

    6445.2.PNG

    Option 2: Export existing inactive records and reimport (Suitable for 100,000 records)

    Click on advanced find>>Add your query, status=inactive>> Edit columns, add activated/deactivated by+Activated/deactivated on+Modified by+Modified on>>click results>>click export to excel

    In the downloaded excel, copy paste 'modified by' & 'modified on' to 'activated/deactivated by' & 'activated/deactivated on' respectively>>go to sales>>account>>import>>upload this list

    Option 3: Create a custom job to achieve this

  • Sateesh123 Profile Picture
    Sateesh123 130 on at
    RE: Retrieve records (count) which are deactivated in specified month

    @Meharin, I accept your solution. But it works for those records which I'm going to deactivate now onwards. But I need the old records which are already deactivated.

    Issue here is "One batch job is there, which updates all the records (active/inactive) through an SDK call". So active or inactive all the records are getting modified daily.

    How can I apply custom field "Status Change Date" logic to those old inactive records ?

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Retrieve records (count) which are deactivated in specified month

    Hi Sateesh,

    Refer the link below for determining the number of active accounts. 

    https://community.dynamics.com/crm/b/crmpowerobjects/archive/2015/11/09/determining-total-record-counts

    Similarly we can do it for inactive accounts too.

    Hope this helps.

    Thanks

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve records (count) which are deactivated in specified month

    According to the condition we gave ("Status" equals inactive AND "Status Change Date" last month) , only those records that are deactivated in that particular month will be shown( excluding the records that were already in inactive state).

    And if you want to know the count, go to the view which you have saved(advance find view discussed in above reply). To the bottom right end you can see the count of records.

    count.png

    Choose the saved view (near to arrow shown in the image). You can see the records, at the same time can also see the count at the bottom right end.

    Hope this helps :)

    Thank you

    Please do verify if you find it helpful :)

  • Sateesh123 Profile Picture
    Sateesh123 130 on at
    RE: Retrieve records (count) which are deactivated in specified month

    Yes. I need to retrieve those inactive records count month wise, like In a particular month these many records are deactivated.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans