Skip to content

Instantly share code, notes, and snippets.

@4EverBuilder
Last active April 21, 2016 20:50
Show Gist options
  • Save 4EverBuilder/bfebb5d4aed588f8ee911ef5f499e785 to your computer and use it in GitHub Desktop.
Save 4EverBuilder/bfebb5d4aed588f8ee911ef5f499e785 to your computer and use it in GitHub Desktop.
return if !CurrentRecord.IsInProgress
timenow = dateprint({format:"U"})
emp = db_record({system:"Employee" , id:CurrentRecord.Employee})
contact = db_record({system:"Contact" , id:emp.Contact})
opunit = db_record({system:"OperationalUnit" , id:CurrentRecord.OperationalUnit})
ename = string({input:emp.DispayName , function:"urlencode"})
url = "https://yourtyeform.typeform.com/to/FORMID?shift_id=#{CurrentRecord.Id}&employee_id=#{CurrentRecord.Employee}&employee_name=#{ename}&location_id=#{opunit.Company}"
msg = "Hey #{emp.FirstName}, please fill out this call report #{url} ";
#If timesheet started in last 10 seconds, then email
log({message:"CurrentRecord.StartTime #{CurrentRecord.StartTime} timenow #{timenow} "})
if CurrentRecord.StartTime + 100 > timenow
log({message:"Sending message #{msg}"})
`<cwa_notify emp="emp.Id" link="$url" message="Please check your email for the call report"/>`
`<cwa_email to="contact.Email1" subject="Call Report to Fill Out" message="$msg"/>`
`<cwa_sms to="contact.Phone1" message="$msg"/>`
#cwa_sms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment