SHARE
TWEET

Untitled

a guest May 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function timeSheetEntryFromCustomField(notification)
  2. {
  3.   var notif = new Notification(notification);
  4.   var field = notif.changedCustomField("End Time");
  5.   var end = field.value();
  6.   var start = field.card().customFieldValue("Start Time");
  7.  
  8.   try
  9.   {
  10.     var hours = createXeroTimesheetEntryViaApi(notif.member().name(),notif.board().name(),start,end);
  11.     //Let the user know it was successful
  12.     notif.replyToMember("thanks, recorded "+hours+" hours");
  13.     //Reset for next timesheet entry
  14.     field.card().setCustomFieldValue("Start Time","").setCustomFieldValue("End Time");
  15.   }
  16.  
  17.   catch(e)
  18.   {
  19.     notif.replyToMember("Whoa! Something went wrong. Find the nearest IT person and give them this message: "+e);
  20.   }
  21. }
  22.  
  23. /**
  24. * Gets the email of a team member from their username,
  25. * then posts a timesheet entry for the given client
  26. */
  27. function createXeroTimesheetEntryViaApi(username,client_name,start,end)
  28. {
  29.   //NEEDS TO BE IMPLEMENTED VIA XERO API
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top