Input fields – A better approach to filling in the details in a form?

There are two UX models that I have noticed in many applications when it comes to filling in details.

  1. Creation of a new entity or modification of an existing entity via the sliding panel
    Clicking on New would bring up the sliding panel

  2. Open a new page to enter the details. This is seen primarily in places where there is a need for tabs or where there are too many inputs to provide.
    enter the description of the image here

What are the scenarios where one would be better than the other?
Is it recommended to use the new page template if there are more than a number of fields to enter in the sliding panel?