Is there a way to modify an saved example (url, query param,...)

Hi all,
I have a list of saved examples with a portion of path/query in variable as below
Request_1: https://postman-echo.com/get?test={{testId}}
Request_2: {{url}}/get?receiver={{testId}}

  • example_1 (name “example1”):

{{url}}/get?receiver={{testId}}

=> return 200OK with response: {“message”: “abc”}

  • example_2(name “example2”):

{{url}}/get?receiver={{testId}}

=> return 404 with response: {“message”: “abc NOT found”}

request_2 is run after request_1 is finished, and automatically get testId from request_1 to pass into the query_param itself. I have created a mock server pointing to the request_2 above.

The goal is that I want to simulate the different response of request_2 programmatically with only one testId. The idea is before running request_1, I will modify the saved example of the request_2 ( retrieve example_1 by script) and set its {{testId}} to an actual value (e.g. “abc”).

Accordingly, when the request_1 is finished running => the corresponding saved example is returned, the other is ignored.

I have tried to query single collection, grab saved example then replace by my desired value, but it doesn’t change actually

// the code here is defined on Test tab of the request_1

const resp = pm.response.json();

const {collection: {info, item}} = resp;

const filterItem = item.find(el => el.name === "Request To Server");

const {response} = filterItem;

const desiredExample = response.find(el => el.name === "200 - 124")

const {originalRequest:{url: {raw, query}}} = desiredExample;

raw.replace("{{testId}}", "{{new_id}}")
query[0].value = "{{new_id}}"

So I am wondering is there any official way to modify the parts of an saved example ?

Notes: as my permission, I could not modify the header of the request_1 to add x-mock-response* to control the saved example of the request_2.