Cannot read property 'alert' of undefined while creating a plugin.
Question

I was following the course on creating reusable mobile plugins in outsystems. 

https://www.outsystems.com/training/lesson/2086/demo-how-to-create-a-reusable-mobile-plugin

But on completing the steps, I am getting "Cannot read property 'alert' of undefined" error after i assign the client action of the plugin to my app.

Why must this be happening? Please let me know if i might be doing something wrong.


Thanks and Regards,

Amol Rane


mvp_badge
MVP

Hi Amol,

Could you share your .OML for analysis?

Regards.

Yes, sure. Sharing the oml here.

DemoPlugin.oap

Hello @Amol Rane,

Just to clarify, are you testing the application on your mobile device?

If you are simulating in the web browser, then Cordova would not be loaded and that would explain the error.

Regards,

AJ

I am  testing it on my mobile device, not on the web browser.

Great, in that case could you try something like this in your app code and see if Cordova is loaded at the time of calling the plugin?

Hi AJ,

I got the same error event above even though tested on mobile.

I tested on mobile by selecting the PWA and scanning the QR code on my mobile device. Is this the right method?

If not, please show me instructions to test it on my mobile device.

I have tried many times and still can't connect to the plugin server T-T

Thanks.


mvp_badge
MVP

Hi Amol,

In addition to the previous comments, consider the below-mentioned points as well

  • Client action to check if the plugin is available in the target module, i.e. Check the plugin availability.
  • After adding the plugin to the application module, please make sure that you generate a new build of the application & re-installed the application in the native device using the latest installer file (.apk or .ipa) before testing the implemented functionality. Refer to this link -> Situations when the user must install a new build

Please refer to the attached updated .oml file


I hope this helps you!


Kind regards,

Benjith Sam

DemoPlugin.oml

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