Hi David,
With the release of 9.05, the feature to run action script on demand allow users to run the script without being tied to a workflow or behavior.
I beleive this will solve you problem to run a script on all items within a workspace.
thank you,
Trung
Hi Trung,
I don't think this addresses what I'm looking for. I want a way to run a script on all items within a workspace at once (or at least sequesntially but from a single command). The solution you're discussing, although very welcome, only allows scripts to be run on one item at a time.
Regards,
David.
Hi Trung,
I'll give you an example. I have a workspace at the moment with a couple of thousant items in it. All of those items have milestones. I've decided that I want to stop using milestones in that workspace so I want to remove them from each of the items. I think the only way to do this (apart from the UI) is trough scripting.
David.
If I may add a further example...
As an Import does not run an on-create script at present, running a script on all items would allow this to be overcome.
Alternatively if Imports could run scripts, using an Import to edit item details and then run anon-edit script would be a better solution as it would not require a new on-demand script to be created.
Hi,
Is there still no way to run an action script on all the existing items in a workspace?
Thanks,
Jonathan
There is a rest api to call an on-demand script on a dmsid.
I use a utility to run a report to get the dmsids, then loop through calling on-demand script for each item.
Use a filter on the report to identify items not yet processed, so you can safely restart the task.
Both the /reports api, and the on-demand script api, are Gets, not Posts, so they are at the easier end of the Rest api.
I've written such a utility for myself, others have done similar too. I use it almost every day for various jobs.
But there is nothing in the product to run anything in batch.
To help you getting started with the REST API, you may want to have a look at my library of code examples: https://knowledge.autodesk.com/support/fusion-360-manage/learn-explore/caas/simplecontent/content/fu...
This library consists of basic building blocks based on node.js that you can use to get familiar with the given API calls. It even contains an example that shows how to run a given script on a defined record (#62).
What do you want to achieve with the scripts exactly? I also have a library of 'admin helpers' which automate certain admin activities by using the REST API. Would any of these tools shown below be of help? You could use 'Touch Records' for example to update a defined property on all records in a defined workspace to trigger the edit event for these records and with that enforce the edit event script to run. This is very helpful after data imports (which do not trigger the edit event), but might be useful for your use case as well. If these tools are value for you, I am happy to share them.
I am experiencing some sort of authentication issue after following the instructions. I found a single posting with the same problem related to general v3 API access but it wasn't resolved, so I am asking here again with respect to this tutorial...
If I run the script 00-authenticate.js, it appears to run successfully with the following output:
Login to tenant XXXXXX successful
If I run the script 70-workspaces-get-list.js (or any other than 00), I get:
Login to F3M tenant XXXXXXX successful
Error: Request failed with status code 401
Followed by a very verbose error output and eventually:
data: {
errorCode: 'SEC_UNAUTHORIZED',
message: 'Login failed, no user mapped to the given client.',
params: null,
url: null,
errorClass: 'APIError'
}
Any ideas?
OK, quick response to my own posting.... I was poking around in the Administration-->System Configuration-->General Settings page where you have to set your Client ID obtained from Forge. While doing so, I realized that the Client ID field was truncating. The field allows for 32 characters max but the ClientID is 48 characters. Using Chrome, I right clicked Inspect and found the text entry box by searching for "Allowed List". I was able to edit this to 48, able to paste in my full Client ID, and almost fell out my chair when I saw it accepted then again when the Node.js script worked.... Sounds like a bug to be fixed but I'll let the experts weigh in...
On a related note, where can someone find the "admin-helper" tools referenced in the preceding post?
Thanks!
You're right, the ClientID gets truncated right now when you paste & save it in General Settings. I expect this bug to be resolved soon. I occurs right now because the ClientIDs generated by APS are longer since last week. This is not an issue for the code within node.js - therefore, the script 00-authenticate.js works fine. Only once the code really has to connect to PLM with the ClientID (like in 70-workspaces-*), this is causing problems. I will keep you posted once the ClientIDs in PLM do not get truncated any longer.
The admin-helper utilities are available here: https://github.com/dickmans/plm-utilities. After downloading the package, provide your environment settings in settings.js, then you will be able to run all the utilities in folder admin-helpers using node.js