Backstory: I am writing a module to help speed up development time of ProcessFlow-heavy models. One of the more time-consuming but repeatable activities of our standard workflow is resource creation (create PF resource, name PF resource, set location of PF resource, create 3D object, name 3D object, set location of 3D object, link PF resource to 3D object, link PF quantity to table quantity, repeat for potentially hundreds of resources). My idea is to automate most of this.
I've figured out all aspects of this, except automatically creating PF resources.
I have tried the following:
treenode template = getactivity("ProcessFlow", "Resource"); // existing activity reference createinstance(template, Model.find("Tools/ProcessFlow/ProcessFlow"));
treenode template = Model.find("Tools/ProcessFlow/ProcessFlow/Resource"); // existing activity reference from model tree createinstance(template, Model.find("Tools/ProcessFlow/ProcessFlow"));
treenode template = views().find("modules/ProcessFlow/DragDropLibrary/Shared Assets/Resource"); // template activity reference from view tree createinstance(template, Model.find("Tools/ProcessFlow/ProcessFlow"));
treenode template = maintree().find("project/library/processflow/activities/ResourceBlock"); // template activity reference from main tree createinstance(template, Model.find("Tools/ProcessFlow/ProcessFlow"));
All result in exceptions that make the saved model un-usable.
I've looked through previous questions on here. I found one from 2017 which says this is not possible (at least at the time) due to a design choice:
https://answers.flexsim.com/questions/42248/creating-processflow-with-flexscript-code.html
Is this still accurate? If so, are there any alternatives? Surely there is code in the backend that is triggered when, say, dragging/dropping from the library, or copying and pasting an existing activity. Is this accessible?