Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add End date of Delegation in time when a new delegate created

sattar3
Tera Contributor

Hello All,

 

We have catalog item to request a Delegate.

User can select the start and end dates only.

Like if user selected from 01-08-2024 to 02-08-2024 then the end date will be on 2nd August.

We need to add the end delegation time as 02-08-2024 23:59:00.

 

Could you please help me on this?

 

@Dr Atul G- LNG @Ankur Bawiskar @Community Alums  @Mark Roethof 

Thanks,

Sattar 

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @sattar3 

 

I checked in my PDI, system takes the current time as the start/end time, which is expected. I think instead of customizing the system, educate users to put time till 23:59

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@sattar3 

why not have those fields as date/time instead of only date?

If you want the script; you can get the value and set it in the field

what script did you start with and where are you stuck?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  Thanks for the reply.

Our client don't want to show the time to select.

 

Anyway i written the below script in the flow itself which is working.

End Delegation with time:

 // Getting variable date
    var vacEndDate = fd_data._1__get_catalog_variables.vac_end_date;
    // Concatenating the date with time 23:59:00
    var newEndDateTime = vacEndDate + " 23:59:00";
    // Returning new time in Delegation End Time
    return newEndDateTime;
 
Thanks,
Sattar