Where did you put the code before adding the source?
You always need some event to trigger the execution of the code. The 'On Run Start' model trigger might be a good option for this.

Instead of creating the item directly in the storage, you might want to first create them in the model and then move them into the storage ('moveobject(object, destination)'). Otherwise the placement logic won't work correctly.
The 'createcopy()' command returns a reference to the created object (which you already assign to the 'item' variable). As such you can assign labels with the normal syntax (item.labelName = value).
if(Model.time == 0) // Only on first start
{
// Get references to reuse them in the loop
Object destination = Model.find("FloorStorage1");
treenode flowItem = Model.find("/Tools/FlowItemBin/Box/1");
for(int i = 1; i <= 25; i++)
{
Object item = createcopy(flowItem, model());
item.creationRank = i;
moveobject(item, destination);
}
}Because you put the code in the inter-arrival time but don't return any value (the time value that is expected from the code), the value is assumed to be zero and the inter-arrival time triggers again immediately. This repeats until the storage is full.
create-object-using-code-fm.fsm