Linking multi-sided token back to its rollable table

I'm looking to create a simple in-chat interface so I can change the sides of a multi-sided token by choosing from the names of the items that I added to its originating rollable table. The goal is so I can easily switch between NPC portraits during dialogue, or background scenes during story. It's easy enough to get a list of sides for a token, and to change those using the API, but I'm having trouble linking those sides back to the names given for them in the rollable table. Can anyone suggest a way to do this? One could theoretically put the rollable table's ID in the gm-notes for the token, then read that and link back (correlating sides and table items based on ordering, which seems to hold true), but it's pretty kludgy. Since all the data is there, I'd love a way to make the link automatically based on the information in the auto-generated multi-sided token, but not seeing it at the moment...

Edited 1506573838
The Aaron has a scriptlet in the  "Any way to make a rollable token inherit the name from the table?" thread that can probably do what you want. You could potentially combine that with  ChangeTokenImage by Chris B. for scriptifying the token-changing process.
Brilliant -- thank you!