pega.desktop.createNewWork - 403 Forbidden error

We are trying to start a new case from an HTML fragment that is displayed only in certain conditions.

The HTML fragment uses the pega.desktop.createNewWork function to create the new case.

This works fine for developers, but test users are getting a 403 Forbidden error message.

If we disable pyBlockUnregisteredRequests and pyShowSecureFeatureWarnings, the error does not show up but there must be a better way to prevent the error.

We are on 8.8.3 on Pega Cloud.

I was able to get it to work by adding the following in the javascript:
<% ClipboardPage actionPage = pega.getUIEngine().getUIActionPage(“createWork”);
actionPage.getPage(“pyActionAPI”).putString(“pyClassName”,“MyClass”);
actionPage.getPage(“pyActionAPI”).putString(“pyFlowName”,“MyFlow”);
pega.getUIEngine().getUIAction(actionPage).register();%>