But i only need the 23 as environment variable.
My test script looks like this what do i have to do to only get the 23?
pm.environment.set(âDownloadLinkâ, pm.response.json().message);
You could take a look at the .split() JS method to get that part of the string. This will create a new array of values based on the separator provided. Then you would need to specify the item you want, this will be zero-indexed so 0 would be the first item.
For example:
let messageString = pm.response.json().message
pm.environment.set("DownloadLink", messageString.split('/')[5])
This obviously fails to extract that value is the position were to change.
âThere was an error in evaluating the test script: TypeError: Cannot read property âsplitâ of undefinedâ.
I need to capture only the âcustomer123@example.comâ value as a variable from the âdescriptionâ string below. Is the error occurring because âdescriptionâ is nested in the ticket property? Can you suggest adjustments to script to capture the value as a variable?