-
Hi, I had a question about the syntax for Template Expression expansion when operating with a # Set a general rule to assign a postman id variable from the response bodies
# of any POST or GET requests
assignVariables:
- openApiOperation: POST::*
collectionVariables:
- responseBodyProp: id
name: <tag>Id
- value: <tag>
name: currentTag When I look at the generated test I see the following: // pm.collectionVariables - Set categoriesId as variable for jsonData.id
if (_resId !== undefined) {
pm.collectionVariables.set("categoriesId", jsonData.id);
console.log("- use {{categoriesId}} as collection variable for value",jsonData.id);
} else {
console.log('INFO - Unable to assign variable {{categoriesId}}, as jsonData.id is undefined.');
};
// pm.collectionVariables - Set fixed value for currentTag variable
pm.collectionVariables.set("currentTag", "<tag>");
console.log("- use {{currentTag}} as collection variable for value", "<tag>"); So it seems that when I use Is this just my poor usage or something that isn't supported. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
hi @jpjpjp At the moment the template expressions are only converted for variable "names". But reading your example here, makes me consider to expand it and also support it for "value". |
Beta Was this translation helpful? Give feedback.
@jpjpjp
I added the capability to assign collection variable values, using template expressions.
See the PR for the BEFORE/AFTER results.
Am I correct that this is what you expected?