Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function timeSheetEntryFromCustomField(notification)
- {
- var notif = new Notification(notification);
- var field = notif.changedCustomField("End Time");
- var end = field.value();
- var start = field.card().customFieldValue("Start Time");
- try
- {
- var hours = createXeroTimesheetEntryViaApi(notif.member().name(),notif.board().name(),start,end);
- //Let the user know it was successful
- notif.replyToMember("thanks, recorded "+hours+" hours");
- //Reset for next timesheet entry
- field.card().setCustomFieldValue("Start Time","").setCustomFieldValue("End Time");
- }
- catch(e)
- {
- notif.replyToMember("Whoa! Something went wrong. Find the nearest IT person and give them this message: "+e);
- }
- }
- /**
- * Gets the email of a team member from their username,
- * then posts a timesheet entry for the given client
- */
- function createXeroTimesheetEntryViaApi(username,client_name,start,end)
- {
- //NEEDS TO BE IMPLEMENTED VIA XERO API
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement