Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
This guide requires the scheduler plugin in Joget Marketplace to perform functions based on schedule.
One of the features of the scheduler plugin is that it allows bean shell script to be executed at defined durations, in a form of CRON expressions.
First, download and import the plugin appended below, into your Joget installation.
After importing the plugin, add the scheduler userview element into your userview. Then, define the schedule frequency using CRON expression. Then select the bean shell option in "Plugin" and click on the "Configure Plugin" button, copy and paste the following bean shell code below.
Save the record.
import org.joget.directory.model.service.DirectoryManagerProxyImpl; import org.joget.directory.model.service.DirectoryManager; import org.joget.apps.app.service.AppUtil; import org.joget.plugin.ldap.SyncLdapUserDirectoryManagerImpl; import org.joget.plugin.directory.SecureDirectoryManagerImpl; DirectoryManagerProxyImpl proxy = (DirectoryManagerProxyImpl) AppUtil.getApplicationContext().getBean("directoryManager"); DirectoryManager dm = proxy.getDirectoryManagerImpl(); if (dm != null) { if (dm instanceof SecureDirectoryManagerImpl) { dm = ((SecureDirectoryManagerImpl) dm).getEdm(1); } if (dm != null && dm instanceof SyncLdapUserDirectoryManagerImpl) { int total = ((SyncLdapUserDirectoryManagerImpl) dm).syncUsers(); System.out.println("Total users : " + total); } }