How to create Catalog Task on particular date through workflow

Community Alums
Not applicable

We'd like to include a Catalog Task in our workflow. The unique feature is that we want to create Catalog Task on a specific day (this date will be derived from the catalog variable), therefore the workflow should pause and wait till the current day matches the date on the catalog variable.

1 ACCEPTED SOLUTION

Deborah Brown L
Kilo Sage

Hi @Community Alums ,

you can use a timer before creating that catalog task and in that timer you can write a script which I mention below,

var date = current.variables.datefield.getDisplayValue(); //your date variable
var duration = gs.dateDiff(gs.nowDateTime(), date, true);

answer = duration;

 

 

Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown

View solution in original post

4 REPLIES 4

Sujatha V M
Kilo Patron
Kilo Patron

@Community Alums Please follow the below steps on the link, 

 

https://www.servicenow.com/community/developer-forum/generate-a-task-based-on-a-specific-variable-date/m-p/1432019

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Deborah Brown L
Kilo Sage

Hi @Community Alums ,

you can use a timer before creating that catalog task and in that timer you can write a script which I mention below,

var date = current.variables.datefield.getDisplayValue(); //your date variable
var duration = gs.dateDiff(gs.nowDateTime(), date, true);

answer = duration;

 

 

Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown

Community Alums
Not applicable

Hello @Deborah Brown L 

Thank you for the Solution. The solution worked but there is one issue with that.
For Example: I have selected date as 6th April 2024 , then task need to be created on 6th April but with above script the task creation date is 5th April 2024 11:59:59 .Can you please help us here to solve this.

Thank you!


@Community Alums , 

You can just add an extra day.

var date = current.variables.datefield.getDisplayValue(); //your date variable
var duration = gs.dateDiff(gs.nowDateTime(), date, true);

duration.addDays(1); 

answer = duration;

 

Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown