- For: Young Leader co-ordinators and Explorer leaders
- You get: a form a Young Leader fills in on their phone, and their hours in Scoutworks a moment later
- Time: about fifteen minutes
- Scopes:
members:readandrecognition:readto try it;recognition:writeto log hours
1. Try the requests
memberId; an adult’s carry their userId. A Young Leader’s note is free text, so it is never read back through the API.
2. Make the form
In Google Forms, make a form called Young Leader hours with four questions, named exactly:
Choose ⋮ → Script editor. Delete what is there, paste the script below and choose Save.
Code.gs
3. Add your key and the names
Choose Project Settings (the cog), then Script Properties → Add script property. Property:SCOUTWORKS_API_KEY. Value: the sandbox key to try the names, or your own key.
Select fillNames and choose Run. Allow it to edit the form. The Your name dropdown now lists your Explorers and Network members. Run it again when new Explorers join.
4. Log each answer
Choose Triggers (the clock) → Add Trigger: function onAnswer, event source From form, event type On form submit. Allow it to reach an external service.5. Try one answer
Fill the form in once yourself, as one Young Leader, for 15 minutes. Open that young person in Scoutworks, then Young Leader → Hours: the entry is there, with your note. If it was only a test, delete it there. Each answer’s own id is itsIdempotency-Key, so if Google retries the trigger, the hours are logged once.
6. Switch to your group
Changeapi-demo.scoutworks.app to api.scoutworks.app, and put your own key in Script Properties. It needs members:read for the names, recognition:read, and recognition:write to log hours.
Variations
- Adults too. Send
userId(an adult’s id fromGET /adults) in place ofmemberId, and the hours appear in that adult’s volunteer hours. - A DofE summary.
GET /volunteer-hours?memberId=and the young person’s id lists everything they have logged.
If something goes wrong
Failed answers show under Executions in the script editor. See Errors for every code. A400 naming memberId means the young person has left the group: run fillNames again.