[CryptoJS] CryptoJS
Mobile icon
Forge component by Ryan Surjadi

Hi  there, if i am trying to use this component CryptoJS, after setup i run the application but i get an error say 

CryptoJS is not defined

The setup is simple, i provided the following input parameter

  • key
  • string
  • Encryptedtxt
  • Decryptedtxt

When i click on the EncrptedButton it will call the EncryptOnClick client action;

That is where i drag CryptoJS reference EncryptAES_Client. In the EncryptAES_Client i map the key and message to my input parameter key and string.


Hi Jerah,

I think Ryan Surjadi (developer of this component) has recently updated the component on forge to resolve the error. Probably after your post.

You can try to update component on your environment and see if it works now.

Hi @Jerah 

Sorry for late respon, crypto js not defined happen because you don't depend script from my component and my bad i forgot to public the script and not describe to depend all script from my component. but with the newer version,i adding a block to depend so you must try again to update and depend new block. please feedback again if you facing same issue . thanks

Hi , just to update you i had update the forge.

Now when i start the application there is no more error.

But the error come when i click on the Encrypt Button which run the action EncryptOnClick.

The EncryptOnClick run the EncryptAES_Client the action end with an assignment which i assign the result from EncryptAES_Client.Encrypt to my local variable EncryptedTxt.

can you attach a screenshot of your logic?

Please see screenshot below;

Main screen interface

Encrypt and Decrypt Client Action

Local variables

Hi , I don't know what's wrong with your logic, but i already test in my personal and not getting error.

assuming my local variable name
textvar = key
textvar2 = string

texvar3 = encrpt

textvar4 =decrypt

No worry , i delete the entire project and redo again.

Btw at the server side will i be able to use php to decrypt using the same key ?

Never test before, but i think encrypt logic must be same with decrypt so if you open crypto Js Server extension from my component and do the same in php.. I think it'll work...

Thank you so much for the feedback , i will install and try again and feedback the result.

I had delete the whole project

Recreate a new project 

When i do a debug, the error occur when it is at EncryptAES_Client. 

I had check the parameter had been past accordingly from my input such as key and string

I had also updated my outsystems to the latest version

Is there any other setting or script that need to put in place

No , If you rebuild with my screenshoot before i think it'll work. 

Please attach the error message here

It is the same error message;

CryptoJS is not defined

Did you insert weblock call script JS into the screen?

No i did not can you show me where to do this , thank you

Please refer to see again what i attach from my screen shoot before, thanks

Sorry , i am new to this so , not sure if i understand you correctly when you say insert weblock call script JS , do you mean the client action ?

I created 4 inputkey, the first 2 is enabled for user to input their value. The other 2 is disabled as it is for the application to display the value. I tie this inputkey to the local variable accordingly

I added a button and tie the button to the client action EncryptOnClick

When i click on the Encrypt button it just run the EncryptOnClick

The had also added the necessary plugin CryptoJS

What i do not have compare to your screen is the DataAction1 and DataAction2

please see careful about my screenshot, i already attach this before, you just do it the same way, see below the button  widget,add web block from my component name "SCRIPTJS"

My ScriptJS appear as below but there are nothing inside

Do you add any script inside manually ?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.