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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Batch Jobs in MS CRM

(0) ShareShare
ReportReport
Posted on by 10
We need to create a batch that will Activate/Deactivate custom entity "agent" record based on their End Date.
This batch job will need to run on a daily basis around 9 PM SGT.  When executed, it should 
  1. Deactivate all active custom entity agent with an end date  of "today" or in the past.
  2. Activate all inactive custom entity  agent with an end date of null or in the future.

please let me know whether we can do it using batch jobs or any other method

  
I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    I am not sure if you Online or On-Premise, but you can do the following.

    In case you are Online, just create a Power Automate Scheduled flow that will run on a daily basis. Use a list records CDS action to list all of the records that are expiring on that day, and add a For Each Loop control that will go over through each of the items. Then Update the Status and Status Reason for each one of the records that you are looping through.

    If you are On-Premise (or don't want to use Power Automate flow for whatever reason), you can use SSIS with a tool such as Kingswaysoft that will retrieve these records, and then do an update on these records to update the Status and Status Reason fields (statecode, statuscode).

    Hope this helps.

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    It is very much possible with console application. And publish console application as Azure web job.

    Create logic app to trigger your web job based on your timings. You can use Xrm.tooling.connector to connect to crm using c#.

    docs.microsoft.com/.../microsoft.xrm.tooling.connector.crmserviceclient

    You can write query expression or use advanced find to build fetch xml query to get your records and process.

    If found helpful, Please mark my answer verified.

  • MSCRM _Developer Profile Picture
    10 on at

    I'm using online 365 .  

  • MSCRM _Developer Profile Picture
    10 on at

    Thanks Bipin. I have mainly worked in customization and configuration and javascript. This is my first console application. will follow this link and if i have any doubt will post it here

  • MSCRM _Developer Profile Picture
    10 on at

    can you explain more about using this in online

  • Ingailly Profile Picture
    5 on at

    Hi, everyone! Guys, i would like to offer to each of you some really helpful web resouse which will give you much more detailed information about this issue: https://grademiners.com/

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi,

    I think this is a good starting point.

    docs.microsoft.com/.../run-scheduled-tasks

    You can also check if there is some content on Microsoft Learn or check out the Flow in a day training:

    https://aka.ms/flowinaday

    These will all give you an overview of how you can achieve these.

    Hope this helps.

  • MSCRM _Developer Profile Picture
    10 on at

    Hi Aric,

    Thanks a lot. I just followed your steps and was able to achieve it

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans