I have a manual trigger to request the Schedule date and time to the user and create the request type in the JSM project.
The user needs to select the next weekday (Mon to Thu)
And the hour of the maintenance start, not the minutes
I need to set both (weekday and time of day user inputs) to the Planned, Start, Planned End, etc to have this scheduling showing on the Change Management Calendar.
Those are date time picker fields, so its mandatory to have time and minute set up.
The first thing I did was a rule with if else using the strings to set the weekday - but the problem is - I can't do if/else to the time of the day due to the limitations of components in each automation rule.
So I have the following "structure"
1) The user Input menu, have 2 variables
- userInputs.weekday
- userInputs.timeofday
2) Then I have a create request type action as follows
The smartvalues functions I tried so far no success
{{now.withNextDayOfWeek("{{userInputs.weekday}}").withHour({{userInputs.timeofday}}).withMinute(0).setTimeZone("America/New_York")}}
It does not get the option for DayofWeek
Options are set as string MON, TUE, WED, THU
So I thought that being string inside " " would work.
I removed this part of the weekday and tried only
{{now.withNextDayOfWeek("MON").withHour({{userInputs.timeofday}}).withMinute(0).setTimeZone("America/New_York")}}
The timeofday input is Number, so I assume that it would just replace with the number collected.
It didnt work
Tried also
{{now.withNextDayOfWeek("MON").withHour({{userInputs.timeofday.asNumber}}).withMinute(0).setTimeZone("America/New_York")}}
It didnt work
3) I tried also to create a new variable {{vartime}}
{{now.withNextDayOfWeek("MON").withHour({{vartime}}).withMinute(0)}}
It also didnt work
Help???
Hello @Patricia Francezi
When using a smart value as an input to a function, you don't usually include the curly braces.
I tested this, using Log actions to print the values in the rule execution Audit Log.
{{now.withNextDayOfWeek(userInputs.weekday)}}
That generated the correct date based on the input.
Use the same concept with the hour of day.
{{now.withNextDayOfWeek(userInputs.weekday).withHour(userInputs.timeofday)}}
Learned that. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.