Conditional jump to a specific step

Jumps to a specific step depending on the day of the week returned by the first step of the workflow.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

  - 
  
 getCurrentTime 
 : 
  
 call 
 : 
  
 http.get 
  
 args 
 : 
  
 url 
 : 
  
 https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam 
  
 result 
 : 
  
 currentTime 
 - 
  
 conditionalSwitch 
 : 
  
 switch 
 : 
  
 - 
  
 condition 
 : 
  
 ${currentTime.body.dayOfWeek == "Friday"} 
  
 next 
 : 
  
 friday 
  
 - 
  
 condition 
 : 
  
 ${currentTime.body.dayOfWeek == "Saturday" or currentTime.body.dayOfWeek == "Sunday"} 
  
 next 
 : 
  
 weekend 
  
 next 
 : 
  
 workWeek 
 - 
  
 friday 
 : 
  
 return 
 : 
  
 "It's 
  
 Friday! 
  
 Almost 
  
 the 
  
 weekend!" 
 - 
  
 weekend 
 : 
  
 return 
 : 
  
 "It's 
  
 the 
  
 weekend!" 
 - 
  
 workWeek 
 : 
  
 return 
 : 
  
 "It's 
  
 the 
  
 work 
  
 week." 
 

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .

Create a Mobile Website
View Site in Mobile | Classic
Share by: