1

{{partnerOrderId}}- is Prerequest script through created value and considering this value as - 23457891

I have created partnerOrderId using this code:

const partnerOrderId = Math.floor((Math.random()*333333333))
pm.globals.set("partnerOrderId", partnerOrderId);

-partner2345- -this value is constant.

I have to pass value as 23457891-partner2345-23457891

I tried below code in post man. But its showing error.

  "partnerOrderNumber": {{partnerOrderId}}+\"-partner2345-\"+{{partnerOrderId}},  
Soorya Thomas
  • 391
  • 1
  • 8
  • 23
  • I've provided an answer based on what I _think_ the question is but the details you have provided, don't really make any sense so I would suggest re-writing the question. – Danny Dainton Feb 15 '19 at 11:03

1 Answers1

1

If you add something like this to the Pre-Request Script to create the variable:

let partnerOrderNumber = `${pm.globals.get('partnerOrderId')}-partner2345-${pm.globals.get('partnerOrderId')}

pm.globals.set('partnerOrderNumber', partnerOrderNumber)

Postman

You will be able to use this variable in the Request Body like this:

"partnerOrderNumber": {{partnerOrderNumber}} 
Danny Dainton
  • 23,069
  • 6
  • 67
  • 80