Question - In which conditions should we use global, collection, and local variables?
Answer -
Global variables are the general-purpose variables. They are used while passing data to other requests and are ideal for quick results and prototyping.
Collection variables are generally used for storing some constants that do not change during the execution of the collection. These variables are used for constants that do not change during the execution and URLs / authentication credentials if only one environment exists.
Local variables are the temporary variables and are only available within the request that has set them or when using Newman/Collection runner during the script execution. These variables are used whenever we have to override all other variable scopes.