To automatically create SharePoint folders for newly created records you can use a record triggered flow which runs after the record is saved, this works even without files being attached to the new record. Log in to Salesforce and go to Setup and search for Flows, click the New Flow button in the right top corner. Choose the Record-Triggered Flow type, select an Object for which you want to create the Trigger Flow and fill in the following configurations:
When you have specified the configurations above, click the + Add Scheduled Paths (Optional) button below the configuration section.
Fill in the Path Label, Time Source, Offset Number & Offset Options. For this example we’re using the Contact: Created Date for Time Source, 1 for Offset Number and Minutes After for the Offset Options. This means the Scheduled path is running 1 minute after the new record is created.
The last thing we need to do is to add the File 365: Ensure SharePoint Location apex action in the Scheduled Path. Click on the + Button in the Scheduled Path and select Action, search for the Ensure SharePoint Location invocable and add the Record ID from the triggering record to the Record Id variable.