mpw83
5 years agoContributor
Solved
Get ID dynamically and do a property transfer ?
I have a REST request which returns IDs. It's cannot be guaranteed about the number of records. Sometimes the number of ID's is 2 and sometimes more than 2 (e.g. 4). I need to get these ID's and do a...
- 5 years ago
Hi mpw83 ,
In that case you can use groovy script and use jsonSlurper, use the below groovy code.
import groovy.json.JsonSlurper def ResponseMessage = testRunner.testCase.getTestStepByName("Name of your Test Step").getPropertyValue("response"); def jsonSlurper = new JsonSlurper().parseText(ResponseMessage) mainRecord = jsonSlurper.records for(i=0;i<mainRecord.size();i++){ recordsID = mainRecord[i].peer__Schedule__r.records; for(j=0;j<recordsID.size();j++){ log.info recordsID.Id[j] } }
Hope it will help you i n resolving your problem.