Hello,
Do you have an idea on how to encrypt a string to MD5 using Rollbase Object Script trigger?
I have tried many md5 JavaScript functions which work just fine when used in my web-browser directly (in console).
But when I use them in an object script, I get a different result.
For instance,
The string "hello" encrypted to md5 gives :
"5d41402abc4b2a76b9719d911017c592"
I have a JavaScript function which works just fine and encrypts "hello" to "5d41402abc4b2a76b9719d911017c592".
When I use this function in an object script trigger, it returns "fe53e8f02c0cea90abc7134fe75c7cda".
Why is that?
I don't know what to do, I have tried many different MD5 JavaScript functions, I always end up with a wrong result in my triggers, but with a good result when used in the web browser.
Please this is an important and almost urgent matter to us because we need to encrypt strings in md5 for one of our customers as soon as possible.
Kind regards,
Romain
Hi Romain, is it a custom function?
How do you make it available in the serverside ( Object Script ) ?
Can you share the function code pls?
Hello,
Thank you for your answer!
I have tried on Rollbase Hosted Cloud and it actually works fine.
It just doesn't work in our Rollbase Private Cloud Instance.
We use the following code (see attachments):
- In Rollbase Hosted Cloud (replace "console.log" with "rbv_api.println" to try it), and when directly computed by Web browser (Google Chrome), it prints : 5d41402abc4b2a76b9719d911017c592 (Which is correct)
- In our Rollbase Private Cloud, it prints : fe53e8f02c0cea90abc7134fe75c7cda (Which is incorrect)
Do you know if this is this due to an encoding issue?
We use UTF-8 in our Tomcat configuration.
Thank you,
Kind regards,
Romain.
Yes I too tried in my dev environment ( 4.0.3) and it works fine. I get ( 5d41402abc4b2a76b9719d911017c592 )
Like Thierry asked, which Rollbase / Java versions?
Hello,
Thank you for your help.
Actually, I just noticed that it works fine when doing a rbv_api.setFieldValue!
The error only occurs in the debug window (When testing the trigger, the "println"it prints the md5 hash as "fe53e8f02c0cea90abc7134fe75c7cda", but in the end it stores the value "5d41402abc4b2a76b9719d911017c592" in the field, which is the correct value.)
This is great news for us, because this means that it is in fact working, and that the error only occurs when "debugging the formula".
Still, it is a weird behaviour and we lost quite some time because of it.
You will find an app in attachements to try it out. When debuggin the formula, the "println" function prints "fe53e8f02c0cea90abc7134fe75c7cda" in our case (when having typed "hello" as string to encrypt).
We are using Java7, Tomcat7 and Rollbase 2.2.2.0. (We hope to migrate to 4.0 as soon as possible).
Thank you very much for your help.
Kind regards,
Romain.
Glad that it works. It is weird; but since the issue is in 2.2.x & not on 3.2.x or 4.0.x, we'll not chase it.