The CreatorCon Call for Content is officially open! Get started here.

Change Date to Date/Time and update Due_date

Mohamed Rahim1
Giga Contributor

I have a catalog item where the user provide date variable, and the requirement i have is to take this Date let's say (31/03/2022) and convert it to (31/03/2022 11:59:00) - the time is fixed meaning that it will always be 11:59:00 regardless the date input, then update the SC_Req_item.Due_date with the new date/time (31/03/2022 11:59:00)

The flow is created by the flow designer.

Can you help me with how to do this and if it requires a script in the flow designer can you help with the script too

1 ACCEPTED SOLUTION

Hi,

update as this

if (fd_data._1__get_catalog_variables.question1 == "yes") {
    return fd_data._1__get_catalog_variables.date + ' 23:59:00';
}
else {
    return fd_data._1__get_catalog_variables.date + ' 17:00:00';
}

Regards
Ankur

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use f(x) inline script to set the due date

You can use Update Record action and script it

Regards
Ankur

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

Can you help me and share how the script would look like

Hi,

Like this

1) I assume you are using Get Catalog Variables step to fetch the variable information

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

Can you help me with one last question, I was hoping to build some logic on the script but it's not functioning properly 

question1 is basically Yes/No variable and based on the answer I need to populate a different date

if (fd_data._1__get_catalog_variables.question1 = "Yes") {
return fd_data._1__get_catalog_variables.date + ' 23:59:00';
}
else {
return fd_data._1__get_catalog_variables.date + ' 17:00:00';
}