This example enables you to see how the PerfectForms™ application can connect to an LDAP server.
To download the sample connection, click here. To download the sample form, click here. (These forms are only available for download through the online version of this help guide). First import the connection, and then import the form. To complete the imports, log in to PerfectForms™ and proceed to the Forms Dashboard. Click Import then browse for the .PF file on your local drive and continue through the wizard.
Once the files have been imported you will be able to open them in the PerfectForms™ form designer and see how they were created and configured.
Note: Initially, the sample connection will not work because of the way the PerfectForms™ LDAP server is configured. You will need to complete the following steps:
1. Change the config.xml of your own ConnectionAgent and set your own LDAP server.
2. Change connection settings.
3. Synchronize the changes in the form designer so you can run it in your own PerfectForms™ application.
|
Step 1 |
Set a new datasource entry for the LDAP server into ConnectionAgent's config.xml.
Example:
<datasource name ="LDAPserver chief" id="9" server="192.168.1.55" secure="false" port="389" type="ldap"> <database name ="Data 1" id="11" db="dc=blackdesign,dc=ro" user="cn=test,cn=users,dc=blackdesign,dc=ro" password="test1234" login="*"/> </datasource>
|
Step 2 |
Create a new connection and choose the datasource and database you've set into config.xml.
For this example you will want to get a list of all users (three properties for each user) from the LDAP server and then update one property for a specified user (his description). You can do this through the use of two actions; SELECT and UPDATE.
|
Step 3 |
Create a new SELECT action and add send/return parameters. Selected properties are (for the purposes of this example) distinguishedName, cn (common name) and description. Add these three parameters into the Return Parameters data grid, then fill in the DistinguishedName field with the user's distinguishedName from the specified LDAP server.
Use LDAPAdmin.exe, to connect to the LDAP server and get information from there.
Note: LDAPAdmin.exe is a free tool that can be downloaded from the LDAP Admin Downloads page.
|
Step 4 |
Test the new action by clicking the Test button. This launches the Test Action dialog. Click the Connect button at the top of the dialog. A list of all users should be displayed in the Results section. (An error message will display if the connection failed).
|
Step 5 |
Create a new UPDATE action. Leave the Distinguished Name field empty, then add distinguishedName as a Send Condition Parameter. DistinguishedName is the property that can identify a single user. It is added as a Send Condition Parameter so you can dynamically change its value from the form and use the same form and action to change the description for multiple users. Add description as a Send Value Parameter.
|
Step 6 |
Create a new form that will use the new connection and actions in order to get (and display) the list of users from the LDAP server and change some user(s) description. In the new form you will need:
|
Step 7 |
In the form designer, for the Button is pressed behavior of the Get user from LDAP button, add a Connect script command. Set its Connection and Action properties from drop down lists, then map distinguishedName, cn and description to the corresponding columns in the table.
|
Step 8 |
For the Button is pressed behavior of the Update user description button, add a Connect script command. Set its Connection and Action properties from drop down lists, then map distinguishedName to the dn text input field and description to the desc text input field. You can add additional script commands to display a popup message for the result of the Connect command execution (success or error).
|
Step 9 |
Play the form (select Preview from the Form menu in the form designer) and click the Get users from LDAP button. The table should display the list of all users from the LDAP server.
|
Step 10 |
On the previewed form, enter the DistinguishedName and New Description values to execute the UPDATE. You can copy and paste the distinguishedName from the table above for the user whose description you want to change. Then click the Update user description button. A new dialog should display with either a success message if the UPDATE was successful or an error message if the UPDATE failed. To see the updated description in the user's table, click the Get users from LDAP button again. This step must be repeated because the update was actually performed on the LDAP server and not in the displayed table.
|
Updated: 06/12/2011
Page url:
http://www.perfectforms.com/Documentation/manual/html/?fg_ldap_lookups_examples.htm
PerfectForms™ -- forms software, workflow software, and business process management