Opps. When I was poking at the code I had changed it so you are right.
However I fixed it to correct code which is here:
#given shift scope will return the shift Id IAW the current timestamp
#shiftId = admin.shift.getShiftId()
def getShiftId():
#Day shift Id: 1
#Swing shift Id: 2
#Graveyard shift Id: 3
now = system.date.now()
if system.date.isBetween(now, system.date.setTime(now, 23, 30, 0), system.date.setTime(now, 23, 59, 59)):
return 3
elif system.date.isBetween(now, system.date.setTime(now, 0, 0, 0), system.date.setTime(now, 7, 29, 59)):
return 3
elif system.date.isBetween(now, system.date.setTime(now, 7, 30, 0), system.date.setTime(now, 15, 29, 59)):
return 1
elif system.date.isBetween(now, system.date.setTime(now, 15, 30, 0), system.date.setTime(now, 23, 29, 59)):
return 2
This will execute in the script console without issue. I’m running this in the global project that most of my projects inherit from. The global project has default as the tag provider. I created an expression tag in default tag provider and the tag is erred.
Here is the actual expression:
runScript('admin.shift.getShiftId')