SubForm field updating form field record and Auto Number

SubForm field updating form field record and Auto Number

In the below Workflow, identifying re update the filed is not working well

for each  row in SubForm

info "Add Stock in Inventory" + row.Part_Name;
rec = Add_Item[ID == row.Part_Name];
rec.Stocks_in_Inventory=rec.Stocks_in_Inventory + row.Number_of_Items;
}
 
I want to use Auto numewber to fill the Form Field but it is getting generated only on submission.
I want to add Text + Auto number for some filed. What is the option