Reseting current values to initial values through sendRequest within a Monitor execution

Within a Postman Monitor, is there a valid way to set an environment’s current values to its initial values through pm.sendRequest() or any other method in the pre-request script or test script?

I found that the approach I was taking only updated the initial value, so subsequent requests didnt actually obtain any updated environment variable values.

I’ve tried all the pm.environment.set() and pm.iteratedData.set() etc. functions but have had no luck as those apparently do not function within a monitor’s scope. Anyone have an idea?

Hi @paytonmclo,

If you create a variable, and update it using pm.environment.set() it will only be persisted throughout the monitor run, once the run finishes the value of that variable will not be available. If you want to persist value between monitor runs you can use Postman’s API as that will update the initial values of a variable, allowing the monitors to access those values between the runs. This article below should help you with it: