How to trigger a business rule when date becomes current date ?

Navya
Kilo Contributor

Hi

I am new to Servicenow, Can you please help me on this

How to trigger a business rule when date becomes current date ?

Thanks,

Navya

1 ACCEPTED SOLUTION

Creating tasks will not work for change_request. They are primarily for sc_req_item table only. If you need to create a task from a change_request please use the run script option, glide to the task table and create a new record. It will not show up in your related list but a new record will get created.

View solution in original post

11 REPLIES 11

Navya
Kilo Contributor

Thanks for the response  Shane!

After seeing some questions on schedule jobs in community, you are right Shane.

Can you guide me on this?

I saw the link you share with me. But, I don't see much information.

Do have any links that creates record on table using schedule job when date becomes current date?

It would be more helpful.

 

Thanks,

Navya 

Nitesh Balusu
Giga Guru

Please use something like this.

Create a new scheduled job. Automatically run a script of your choice. Make it run daily, or periodically or however you want it to run.

 

Please modify your script with whatever details you need to fill out.

 

var c= gs.nowDateTime();
var a= new GlideRecord('table name where task needs to be added');
var b= new GlideRecord('your table name with the due date field');
b.query();

while(b.next())
{

if(c>=b.due_date)
  {

a.initialize();
//perform all actions that you need

   }

}