These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

connecting to LDAP

dabram
Registered: Mar 2 2009
Posts: 8

Hi,

I am using Adobe LiveCycle Desinger 8.0 and am trying to connect to LDAP. I have no problem connecting to LDAP and returning the fields that I need when I type in my own network login as a literal string. This is created in the Data View tab.

SELECT givenName, employeeID FROM 'LDAP://DC=my server name,DC=COM' where samAccountName='jsmith'

How do I get the samAccountName to recognize the currently logged in user?

My Product Information:
Acrobat Pro 8.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You need to obtain the 'loginName' from Acrobat's 'identity' object. Because of Acrobat's security restrictions, you will need to use a folder level JavaScript function to access this data. See [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=18384]How to Capture UserID and Add to Form[/url] for the function. You can then call that function from within a LiveCycle Designer to obtain the 'loginName'.

For LiveCycle Designer you can verify this function with the following JavaScript:
// get loginName from trustedIdentity functionvar sLoginName = trustedIdentity("loginName");// build the message textvar sMsg = "Your loginName is: " + sLoginName;// display the messagexfa.host.messageBox(sMsg, "System Login Name", 3, 0);

George Kaiser

dabram
Registered: Mar 2 2009
Posts: 8
Hello,

Ok, I am new to this and finally found out how to operate the Javascript to write code. First thing, where would this code be saved to? I;m sure it must be outside the document since it needs to retrieve the info before the document opens, right?


Best regards,
Dave
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Folde level scripts are either located in the application's 'JavaScript' folder or tlhe user's appliction 'JavaScript' folder. You can use the following code in Acrobat's JavaScript debugging console to loacte those folders:
app.getPath("app","javascript"); // location of the application JavaScirpt folderapp.getPath("user","javascript"); // location of the user application JavaScript foler

You will also want to look at [url=http://www.acrobatusers.com/tutorials/2006/javascript_console]The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript)[/url] and [url=http://www.acrobatusers.com/tutorials/2006/folder_level_scripts]Entering Folder Level Scripts[/url] by Thom Parker for more information about the JavaScript debugging console and folder level scripts.

George Kaiser

dabram
Registered: Mar 2 2009
Posts: 8
I put the code in the JavaScripts folder and ran the code, it executed but with an error of:

trustedIdentity is not defined
Exception in line 1 of function top_level, script Console:Exec
trustedIdentity is not defined
4:Console:Exec
undefined
invalid label
1:Console:Exec
undefined

// get loginName from trustedIdentity function
var sLoginName = trustedIdentity("loginName");
// build the message text
var sMsg = "Your loginName is: " + sLoginName;
// display the message
xfa.host.messageBox(sMsg, "System Login Name", 3, 0);