Thursday, April 30, 2009

[18] Troubleshooting Ldap

Though I don't need to troubleshoot LDAP things quite often, but when I need I use LDAP Browser tool for testing/troubleshooting..

Steps : -1. Download Ldap Browser tool from here.
2. Unzip the files and run lbe.bat to open LDAP browser.
3. Click New to create a session. Name it say LDAPTest.
4. In 'Connection' Tab give the hostname (without ldap: //) say comadc.company.com , give the port say 389, give BaseDN say dc=company,dc=com , Uncheck Anonymous Bind option (This will enabled User info fields below), Give the User DN as username (Exchange user id) Or like cn=Niku Ldap Bind User,ou=Users,ou=niku,dc=company,dc=com , give password in password field.
5. Leave the values in Options tab as it is.
6. Click save and 'Edit Session' window will close.
7. Select the LDAPTest Session in list and Click Connect.
8. If everything is correct then you should see the list of all groups & users in your LDAP directory, if not you need to check configuration again.

After Connection is successful you can fill in relevant enteries in NSA.

In LDAP Server Section give enteries as ( Sample enteries )
URL = ldap : //comadc.company.com:389 Root Context = dc=company,dc=com
Search User = cn=Niku Ldap Bind User,ou=Users,ou=niku,dc=company,dc=com
Password = password

* Note that LDAP implementation & security level varies. Configuring NSA for correct settings is not sometimes easy. If it doesn't work for you, then may be userid being used doesn't have proper security access to read LDAP directory. Be friendly with LDAP/AD administrator... Request him/her to give 'good' read privileges to any test user...temporarily. Try LDAP Browser with test userid and see if it works. If it works then LDAP Administrator can further reduce the privileges till it doesn't break LDAP Browser or Clarity LDAP sync job.

Monday, April 27, 2009

[17] Customizing Email Templates

I used to receive "Scheduler job failed" email messages. Unless I open email and see which job failed, I wasn't sure if that was important/critical...

After changing Email Template, I could receive mail with job name in Subject line of Email. (though there could be other templates which can be customized for different reasons)

Steps :
1. Open ..../niku/clarity/clarity/resource/emailmessages_en.properties
2. Search for email.SCHEDULER_JOB_FAILED=
3. Replace that line with following
email.SCHEDULER_JOB_FAILED=Scheduler job failed - {0} on {3};\n\

4. Refresh Cache or restart App

* Few things to remember : This is just to throw idea how it can be done, different versions may have different template text & parameters so just be careful for that. And importantly and as always, this change may get washed away after Upgrade/SP/FP so need to revisit. This particular example for "en" language.

[16] Which users using Clarity the most ?

It has been Clarity Team owner's/Manager's wish to serve Customers/Users in best possible way. And it's always helpful to get feedback/suggestions from Users who uses Clarity the most. Clarity access logs are helpful but they give IP address not the user's id.

Clarity provides a field LOGIN_COUNT in CMN_SEC_USERS table, which I thought could be of use, but I couldn't find any configurable option to have login count stored in the table. So just thought of having a simple trigger to do this job.

Steps :
1. Open Insert Trigger of CMN_SESSIONS Table
2. Add Following piece. ( This code is for Oracle, for MS SQL it's similar thing to do )

UPDATE CMN_SEC_USERS
SET LOGIN_COUNT = NVL(Login_count,0) + 1
WHERE id = :NEW.USER_ID;


* Revisit this trigger after every SP/FP or Upgrade if this piece needs to added again.

Sunday, April 12, 2009

[15] "OBS is Required" validation check

Somebody asked me how to make Project OBS fields mandatory... I didn't want to introduce any Trigger based solution as it may obstruct Clarity's own Create/Save Project process. So came up with a Java Script workaround that will display following message if Project OBS is not entered. Download code




* Adding custom Javascript thing was one of the most interesting, challenging research I did on Clarity. Adding "OBS is Required" message was another Fun thing. Intercepting Save/Submit button event and then dynamically adding Error message bar was quite interesting research. Specially dynamically adding custom function in Save/Submit button drove me crazy... but at last it was done. I did this Javascript thing somewhere early in 2006 and I was using it for other "naughty" purpose (still using though) but this OBS Message is just recent thing. I tested on 7.5.x, 8.x and 12.x and it works. Attached Javascript is just a foundation, but it can be extended to do 'anything'. I experimented with AJAX calls, data validation checks, Dependent lookups blah blah ... using this Javascript workaround. But word of caution here, improper handling/coding of Javascript may cause Javascript error messages on the screen and may interfere with Clarity's own Javascript functions. Another thing, you may need to Redo this XSL change after ServicePack/upgrade.