How to get planed and end date in workflow from change

Vinod S Patil
Tera Contributor

Hello Everyone

We have requirement on existing normal change workflow,
when change request raised in freezing window(Planned start date and Planned end date), approval request should go Director or senior manager.

Can you please suggest how can I configure in workflow.

@Abhishek_Thakur 
@Sandeep Rajput 

1 REPLY 1

Deepak Shaerma
Kilo Sage

Hi @Vinod S Patil 

Create a before insert/ update business rule first to check the request lies in freezing window or not then moddify your workflow as per your need...

var freezingWindowStart = new GlideDateTime('YYYY-MM-DD HH:MM:SS'); // Set your freezing window start
    var freezingWindowEnd = new GlideDateTime('YYYY-MM-DD HH:MM:SS'); // Set your freezing window end

    var plannedStart = current.getValue('planned_start_date');
    var plannedEnd = current.getValue('planned_end_date');
    
    if ((plannedStart >= freezingWindowStart && plannedStart <= freezingWindowEnd) ||
        (plannedEnd >= freezingWindowStart && plannedEnd <= freezingWindowEnd)) {
        current.u_freezing_window = true; // Custom field to indicate freezing window
    } else {
        current.u_freezing_window = false;
    }

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma