Consider Weekends When Using dateAdd Helper

Hey all,

I am currently using the following statement to map the order date from Shopify + 2 days into a NetSuite "Ship By" field. Currently, weekdays and weekends are handled the same, but I would like to adjust it to basically add 2 business days instead.

I.e.: if an order is placed in Shopify on Friday, the "Ship By" date in NetSuite should end up being Tuesday, where currently it would map in as Sunday.

{{dateAdd $.created_at "172800000" ""}}

I can't figure out how I can differentiate a weekend from a weekday. If I can make that differentiation, I suppose I can use #compare. But maybe there's a better approach.

Thanks in advance for any support.

0

Comments

1 comment
Date Votes
  • Official comment

    Hey Justin,

    That definitely seems to be an interesting approach to setting the Ship By date. Our functions work with explicit date figures and we're not really looking for the Day of the week. Here are your options:

    Option A:

    1. Pass the date to an arbitrary transaction body field
    2. Create a NetSuite workflow or script to process that date per your business needs
    3. Write the date back to the Ship By field

    Option B:

    1. Compute the Ship By date within Shopify
    2. Store this value as a order attribute
    3. Add a field mapping to the Ship By field on your NetSuite form

    For businesses where the Ship By date is critical e.g. gifts, this value often comes from the website itself and in all other use cases, the reference goes off the 'Created At' date for any downstream activities like packing or shipping.

    We'll be sure to put in a note with our engineering team to review the demand and feasibility of recognizing the day of the week within our functions. Appreciate you contributing to the community!

    Best,

    Mannan

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post