Issue with dates on an inbound email action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 11:14 AM
I'm trying to take a date from an inbound email and set that as a catalog variable which has a type of date but when I do this no matter what date I set in the email the variable always gets set as the current date.
The email contains Hire date: 01/07/2023 for example:
This is the inbound email action:
But this is the result I get:
Any suggestions on how best to take a date from an email and just have it populate on a date variable.
Kind regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 12:51 PM - edited 06-23-2023 12:53 PM
@Alex Saager1 , then in that case , you need to use basic string function and change the input hire date into system date format and then you can pass the changed formatted date into glide date time object.
Or if feasible if you can change date format to input date format of hire date in inbound email.
It will work then for you.
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 07:31 PM
Hi @Alex Saager1 ,
Hope you are doing great.
If input date in inbound email is in format mm/dd/yyyy and in your system date format is dd/mm/yyyy, then in that case you need to convert the input date into dd/mm/yyyy and then set value in cart variable.
please try using below code for conversion , it will work for you
var hire_date = email.body.hire_date.toString();
//script to convert from mm/dd/yyyy to to dd/mm/yyyy
var dateParts= hire_date .split('/');
var hire_date_converted_format = dateParts[1]+'/'+dateParts[0]+'/'+dateParts[2];
cart.setVariable(item,'start_date',hire_date_converted_format );
// also make sure in below inbound script of your , make sure you have comment out your previous line where you have set start date direccty with hire date.
:
Regards,
Riya Verma