Skip to main content
  • 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:read and recognition:read to try it; recognition:write to log hours
Young Leaders help on evenings their own section never sees, and the hours they give count towards their award and towards DofE volunteering. Chasing them for a log at the end of term rarely works. This recipe gives them a short form instead: their name, the date, how long and what they did. Each answer is logged straight into Scoutworks as their volunteer hours, the same place a leader would type them.
Logging hours changes Scoutworks, so the read-only sandbox key can fill the name list but cannot log hours. Use your own key with recognition:write, and try one answer first.

1. Try the requests

A Young Leader’s hours carry their 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.
The dropdown shows young people’s names to anyone with the form’s link. Share the link only with your Young Leaders, and set the form to Restrict to users in your organisation if your group uses Google Workspace.

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 its Idempotency-Key, so if Google retries the trigger, the hours are logged once.

6. Switch to your group

Change api-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 from GET /adults) in place of memberId, 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. A 400 naming memberId means the young person has left the group: run fillNames again.