iTranslated by AI
Configuring Kintone Groups, Google Groups, and Bakuraku from SmartHR
Background: Why I did it
Please skip this
Sometimes, you just need to establish systemic criteria or rules. Rules that haven't been codified are, frankly, a total nightmare. So begins the task of trying to extract rules and logic out of thin air. It's like playing a survival game in the thick of a fog; acting blindly just drains your "social HP." We're in the middle of nowhere, equipped like French soldiers from 1917—no one has thermal cameras, and the recon balloon crashed weeks ago.
Inside this "company fog," the only option is to plant some tent poles and derive logic from that shelter. We keep telling the fog: "We’re using this tool or SaaS, and since it works this way, please follow its lead." By repeating this and strengthening the tools, soldiers who wandered off eventually start gathering at the tent. That’s why setting a standard comes first. This is one of the many truths in this world that I arrived at after falling into trenches time and time again.
This tool is part of that standard-setting:
- Automatically transfer SmartHR member info to a Google Spreadsheet. This includes employment status and department info (including job titles).
- A manually operated team table manages settings like "If someone is in the Accounting Dept and is a Director, add them to the Accounting Director team."
- Using the info from this team table, the program verifies Kintone groups, Bakuraku, Google Groups, and Slack groups/permissions.
After that, there's no choice but to show this team table at every opportunity. "This department is set up to join this group automatically" (as you'll see in the tool, it currently just pings an alert to Slack; if anyone writes the auto-provisioning logic, let's grab a Kinmugi beer together). "If you have objections, tell me, and I'll update the table." It doesn't feel like it's working perfectly yet, but at least the fog has cleared around the spreadsheet. As the fog lifts, we might see new enemy weapons we've never encountered before, but that's better than bumping into them blindly in the dark. I'm providing the code below. Since it runs on Google Apps Script (GAS), feel free to customize it for your company.
Regarding the libraries, please refer to the following articles:
Related:
This wasn't my biggest challenge planned for this year, but looking back when the winter chill sets in, it was definitely a turning point I'm glad I thought of. It's one of those cases I love where "an insignificant tool or a simple program flips the game."
Code
Miscellaneous Notes
Please skip this
Some might say that GAS doesn't need classes. That's both right and wrong. After all, nothing is entirely wrong or entirely right; everything has its merits and demerits. This is just the only way I know how to write. The relationship between 'team' and 'crew' isn't great at all, and I'm always waiting for suggestions for improvement. But when you think about it, code reviews are almost pointless—it's more like saying, "This is the standard for the company and for me, so please follow it." If writing variable names in Romaji becomes the trend in the 24th century, I'll have no choice but to burn my work in a drum can. However, if I believe it's beneficial for the individual or the group, review comments do have meaning. You just have to ask yourself: "How would I feel if I had to maintain this source code six months from now?"
When I program, I listen to jazz playlists on YouTube Music, and when I'm really in the zone, I listen to the hip-hop group "Dirty Science". As I listen, I get a premonition that the fog is clearing. Maybe I'll be able to return to my hometown, or maybe reinforcements will come from across the sea.
Discussion