Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

FLOW Designer, conditons

conceicaog
Giga Contributor

Preciso criar um flow com condição de hora, exemplo: Se a reserva da sala for >10 OU após as 18h faça X coisa, porém o campo de condição só me retorna datapill, não consigo preencher o horario.

1 REPLY 1

Nishant8
Tera Sage

Hello @conceicaog , Please do a following:

- Create a Flow Variable of type String (for example name it as is_after_6pm). You can create flow variable from the three dot available on the top

Nishant8_0-1786255636941.png

- Create first step as 'Set Flow Variables' (select it from the Flow Logic) and use below script. To use script first click on the Toggle script option as below:

Nishant8_1-1786256051028.png

Script:

var now = new GlideDateTime();
var localDisplay = now.getDisplayValueInternal(); 
var timePart = localDisplay.split(' '); 
var currentHour = parseInt(timePart[1].split(':')[0], 10);

if (currentHour >= 18) {
    return "yes";
} else {
    return "no";
}

- Now, use this variable is_after_6pm is yes in the time condition along with Reservation Count > 10

Nishant8_2-1786256284796.png

 

Should you need any further assistance, please let me know.

 

Regards,

Nishant