adding timestamp to textvalue in browser clickpath Synthetic Monitors

Hi  All - we need to generate a reconcilation report everyday.

for ex: App --> create recon report --> “Myreconreportname” . so , i have created a Synthetic check to record the session.

for the first attempt, when i do “record Clickpath” it was successful, when i schedule this synthetic check to run every 1 day, Synthetic check got failed saying “Myreconreportname” already exist.

Script i see in the synthetic recorder is:
“description”: " keystrokes on \“txtReconReportName\”",

“textvalue”:“Myreconreportname”

i want to add timestamp along with Myreconreportname so that my synthetic check will succeed everyday.

Appreciate if i can get some solution to this

You will need to use a JavaScript event to generate the report name.

var todayDate = new Date();
var reportName = "Myreconreportname" + todayDate;
api.setValue("reportName", reportName);

you can then use the placeholder {reportName} for the Keystroke value

Hi @HannahM  - Thanks for the reply,

Where can i use the sample script shared by you?

var todayDate = new Date();
var reportName = "Myreconreportname" + todayDate;
api.setValue("reportName", reportName);

My Code is looks like below:

{ “Type” : “keystrokes”,

“target”: {

“locators”: [{

“type”: “css”,

“value”: “#txtReconReportName”

},{

“type”: “css”,

“value”: “.form-control:eq(0)”

},{

“type”: “css”,

“value”: “#txtReconReportName”

},{

“type”: “css”,

“value”: “input[type=\“text\”][id=\“txtReconReportName”]”

}]

},

“masked” : false,

“SimulateBlurEvent” : true,

“description”:“Keystroke on \#txtReconReportName\”"

“textvalue”: “{ReportName}” -- Placeholder as suggested by you

The snippet should go in a new JavaScript event which you add prior to the Keystrokes event.

Thanks @HannahM  it worked.