Are you creating it as a Quick Action? Also, if you are not providing a context for it to match, it will show up under the main Services menu instead of the contextual one.
For a Quick Action you get one or the other. If the workflow settings declare that it receives something (a context), then it shows up in the contextual menu, otherwise it will be in the main Services menu. Don’t forget to check the Services Settings to make sure the Quick Action is enabled.
I recently (six weeks or so ago) created a tutorial that includes some details about Quick Actions and contextual menu items via Applescript and Automator related to this topic. I used to refer to Ben Waldie’s excellent instructions, but I added many details to my description because I couldn’t find his anymore.
The completed tutorial provides a contextual menu item to make it easier to eject local volumes, and I created it to provide a no cost alternative to the recently released “Jettison”. It’s a work in progress, so please make any suggestions for improvement that you’re willing to contribute. Thanks.
red_menace: Thanks for your posting; regrets for the delay in replying.
Yes, that’s what I expected. But it did not.
I changed the workflow’s configuration from files or folders as the input to text as the input, and now the workflow does appear in the Services submenu after I click on a text field.