Software Development

Workflows Tips #39: Get Day of the Week From Date, Convert an Object to a List, and Build First No-Code Workflow Meetup Recording

Welcome to another Okta Workflows Tips post. Read all previous tips.

In this post:

  • How to get the day of the week from the Date & Time card
  • How to convert an object to a list
  • Online meetup replay: Build Your First No-Code Workflow Automation in 25 Minutes

How to get the day of the week from the Date & Time card

You might want to run a flow on a particular day of the week such as Monday or Friday. This tip will show you how to figure out what is the current day of the week.

First use Data & Time – Now card to get the current date and time. Then using Data to Text card, set the format to dddd to get the day of the week result (Friday):

Getting day of the week

Result running this flow:

Getting day of the week result

If you set the format to ddd, the result will be Fri.

You can also set the format to d. In this case the result will be a number corresponding to a day in the week (5 = Friday):

Getting a number corresponding to a day of the week

Thanks to Bryan Barrows (Workflows Builder Advocate at Okta) and Arek Dreyer (Senior Product Engineer at kandji.io) for helping with this tip.

How to convert an object to a list

Object – Map to List card takes an object and convert it to a list using a helper flow.

For example, if you have this object:

{    "drink": "wine",    "main course": "chicken",    "appetizer ": "salad",    "desert": "ice cream" }

You can convert it to a list where each property from the object becomes a key/value pair:

[
   {
      "key": "drink",
      "value": "wine"
   },
   {
      "key": "main course",
      "value": "chicken"
   },
   {
      "key": "appetizer",
      "value": "salad"
   },
   {
      "key": "desert",
      "value": "ice cream"
   }
]

This is the main flow:

Converting an object to a list flow

And the is the helper flow:

Helper flow converting an object to a list

Result running the flow:

[    {       "key": "drink",       "value": "wine"    },    {       "key": "main course",       "value": "chicken"    },    {       "key": "appetizer ",       "value": "salad"    },    {       "key": "desert",       "value": "ice cream"    } ]

Online meetup replay: Build Your First No-Code Workflow Automation in 25 Minutes

In this video you will learn how to build your first no-code workflow automation with Okta Workflows in 25 minutes. You will learn how to build two flows:

  • ⚡️ User activated event ➡️ notify on Slack, send email, and save user information to a table
  • ⚡️ User deactivated event ➡️ call an 3rd party API endpoint

Looking for more videos? Learn from short videos on our Okta Workflows Community YouTube playlist.

Published on Java Code Geeks with permission by Max Katz , partner at our JCG program. See the original article here: Workflows Tips #39: Get Day of the Week From Date, Convert an Object to a List, and Build First No-Code Workflow Meetup Recording

Opinions expressed by Java Code Geeks contributors are their own.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button