Run JavaScript From Action Wizard Instead Of Application Level File
Hey all,
I've been using this code in a JavaScript file saved in the application folder and calling the function from the Action Wizard but I want to paste the code from the JavaScript file into Action Wizard so I can transfer the Action Sequence across multiple computers and not have to worry about the JavaScipt file as well. Any ideas on how I would change this so runs inside of the Action Wizard? Thanks 🙂
// Enter and validate 8 digit numeric case number and add to bookmarks
function enterCase() {
if (this.bookmarkRoot==null || this.bookmarkRoot.children==null || this.bookmarkRoot.children.length==0) {
app.alert("Error! There are no bookmarks in this file.",0,0,"COMPANY NAME");
event.rc = false;
return;
}
var resp = "";
while (resp=="") {
var dialog1 = {
initialize: function (dialog) {
},
commit:function (dialog) {
var results = dialog.store();
resp = results["txt1"];
},
description: {
name: "COMPANY NAME",
align_children: "align_center",
elements: [
{
type: "view",
align_children: "align_left",
elements: [
{
type: "static_text",
name: "Enter case number:",
bold: false,
font: "dialog"
},
{
item_id: "txt1",
type: "edit_text",
alignment: "align_fill",
bold: true,
font: "dialog"
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "OK",
cancel_name: "Cancel",
bold: false,
font: "dialog"
}
]
}]
}
}
if (myTrustedExecDialog(dialog1)!="ok") {
app.alert("Error! Enter case number cancelled by user.",0,0,"COMPANY NAME");
event.rc = false;
return;
}
if (/^\d{8}$/.test(resp)==false) {
app.alert("Error! Invalid case number. Please try again.",0,0,"COMPANY NAME");
resp = "";
}
}
for (var i=0; i<this.bookmarkRoot.children.length; i++) {
this.bookmarkRoot.children[i].name = resp + " " + this.bookmarkRoot.children[i].name;
}
}
myExecDialog = app.trustPropagatorFunction(function(dialogName){
app.beginPriv();
return app.execDialog(dialogName);
app.endPriv();
});
myTrustedExecDialog = app.trustedFunction(function(dialogName) {
app.beginPriv();
return myExecDialog(dialogName);
app.endPriv();
});
