problems with the pre-launch script

338 views
Skip to first unread message

javiermm...@gmail.com

unread,
Jan 8, 2016, 6:12:39 AM1/8/16
to Fujitsu RunMyProcess Developer Community
Hi,

I need to save a value from a JS variable to a Freemarker variable in an invisible way to the user, so I've thought to use the following code, just by clicking the button to update the process:

function saveDates() {
console.log("Inside saveDate()");
var dates= $('#date').DatePickerGetDate(true);
console.log(dates);
RMPApplication.set("requested_days", fechas);
var requested = ${requested_days};
console.log(requested );

if ((requested != "") && (requested != "undefined") && (requested != null)) {
return true;
}
else {
RMPApplication.showErrorBox("ERROR", "The value of var requested is " + requested );
return false;
}
}

saveDates();
//true;


Well, my problems is:
a) If I don't add the last "true;" the button does nothing. I don't understand why, because my function is returning the needed boolean. In this case the Wi is stuck and the process is not updated.
b) If I add the last "true;" the process is updated, but my function is not executed. There are not logs in the JS console, and the variable value is not set.

I've tried moving the JS function code to a javascript widget for itself, but the result is the same.

How can I achieve to build this?
Is this behavior normal? In affirmative case, Why?

Thanks in advance and regards.

Pankaj Kumar

unread,
Jan 11, 2016, 5:31:58 AM1/11/16
to Fujitsu RunMyProcess Developer Community
Hi,

Are you using the js code on "pre launch" script window of "Launc" or "Update" process button?

if yes, please try the below code:-

function saveDates() {
        console.log("Inside saveDate()");
        var dates= $('#date').DatePickerGetDate(true);
        console.log(dates);
        RMPApplication.set("requested_days", fechas);
//fechas, this variablle should be defined and initialize somewhere other js
         console.log(requested );
// variable requested is not defined, should be define somewhere other js

        if ((requested != "") && (requested != "undefined") && (requested != null)) {
                return true;
        }
        else {
                RMPApplication.showErrorBox("ERROR", "The value of var requested is " + requested );
                return false;
        }
}

saveDates();


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/cdb61d1f-4e3d-435c-ab2a-4403cdbde586%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

Reply all
Reply to author
Forward
0 new messages