Thanks @Bastien_Siebman - you’re right but no luck unfortunately.. from Claude:
That confirms it fully — dispatcher isn’t reachable as a global or as a property on any of the API instances we have access to (portfoliosApiInstance, tasksApiInstance, projectsApiInstance). Combined with everything else we’ve tested (no apiClient, no raw fetch/axios/http, no generic Asana client object), the conclusion holds: the Run Script sandbox exposes only the fixed, pre-built resource instances with their fixed method lists — there’s no way to reach the underlying HTTP client or dispatcher from inside a script action in this environment.
Bastien’s client.dispatcher.get(...) pattern works in their codebase because they’re using the Asana Node SDK directly in their own application, where they instantiate and hold a reference to the full client object themselves. The Run Script sandbox, by contrast, only injects narrow, per-resource wrapper instances into the script’s scope — it deliberately (or as a current limitation) doesn’t expose the client/dispatcher that those wrappers are built on top of.
Here’s a summary:
Following up on the dispatcher suggestion: we tested for a dispatcher property on all available API instances (portfoliosApiInstance, tasksApiInstance, projectsApiInstance) as well as a bare global dispatcher. All came back undefined (confirmed via direct reference, which throws ReferenceError for truly undefined identifiers — not typeof, which can give false negatives on undeclared globals).
This, combined with our earlier findings (no apiClient/client/_apiClient object on any instance, no raw fetch/axios/http, and no generic top-level Asana client), indicates that the Run Script sandbox only exposes the specific resource-scoped API wrapper instances (with their fixed method lists) and nothing lower-level. There doesn’t appear to be any way to reach the underlying HTTP dispatcher/client from inside a script action to call an endpoint that isn’t wrapped by one of the provided instance methods (like duplicatePortfolio).
@Mikhail_Melikhov , @Dominik_Brdak , @John_Baldo
Given duplicatePortfolio isn’t implemented on portfoliosApiInstance and there’s no lower-level escape hatch, is there a roadmap for adding it to the Run Script SDK, or is there a different supported way to trigger a portfolio duplication from within a Rule’s script action?