General
Our file is named TEST_005.pdf, our goal is to retrieve the value 005 which corresponds to our invoice number
Script
var ws = new JSE_WebService("127.0.0.1", "http", 8090);
var res = ws.send("/ws/document/"+INTERNAL_DOCUMENT_ID, "GET", {"Authorization" : "Bearer "+ CAPTURE_WS_TOKEN});
var docName = JSON.parse(res.StringResponse).filename;
if(docName != null){
var nameWithoutExt = docName.split(".");
if(nameWithoutExt.length > 0){
var values = nameWithoutExt[0].split("_");
if(values.length > 1)
return values[1];
}
}
return "";