Sunday, March 6, 2016
[23] Generate XOG XML using Excel Template
I created this Excel Macro based XOG XML Generator originally in 2006 and then evolved it over time. This has limitation that it can't do loops within loops like Projects with multiple Tasks in it. For those kind of nested loop requirements, you can use Pentaho Kettle or any other ETL tool. For non-nested requirements this XOG Generator should be fine.
1. Download XOG Generator v2.01
2. Instructions and Sample available in Excel.
Tuesday, April 26, 2011
[22] Integrate from different DB using GEL
I once needed to import some data, on daily basis, from SQL Server to my Clarity database which is on Oracle. Wrote a GEL script which will do this thing in simpler way. Though there are many more efficient ways of data integrations, however this is within Clarity's scope and without need of writing external program/script to achieve this task.
Click here to download the script. Readme.txt file attached.
Monday, April 18, 2011
[21] Experimental Clarity Single Sign On (SSO)
Few days back, I was just experimenting on Single Sign On (SSO) with Clarity and came up with a light weight workaround. Though, it is still in Testing/Beta phase...
Click here (v13) to download source, code, instructions and limitations. (Refer Readme.txt).
For me it is working fine in Windows/Unix environments with Clarity 12.1 on it. (Not tested on earlier Clarity versions, though). Also works for embedded Clarity links/notifications in emails/documents.
Change log:-
18-May-2012 : v13 version published.
18-May-2012 : v13 version published.
21-Sep-2011 : 0.3 Beta Added enhanced security.
19-Apr-2011 : 0.2 Beta Minor Bug Fix
18-Apr-2011 : 0.1 Beta Released
Monday, February 28, 2011
[20] Clarity and Windows 2008 Active Directory
Infrastructure group was rolling out Active Directory upgrade to Windows 2008. Clarity 12.0.x or below doesn't support Windows 2008 Active Directory.
We worked with Clarity and Microsoft team to find a solution. We didn't have Clarity version that supports 2008 AD and Infrastructure team didn't want to stop upgrading to Windows 2008 AD.
After a long battle and with so many calls/emails with Microsoft, we got a fix from them. This needs a registry change in Active Directory Server. It was tested and finally deployed on all Active Directory Servers. Now Clarity (12.0.x) runs fine with Windows 2008 AD.
[ Make following Registry changes in Windows 2008 R2 Domain controller servers]
HKLM\System\CurrentControlSet\Services\NTDS\Parameters
Add String value “DSA Heuristics”
Set the value to 000000000001
More detailed discussion can be found here , and also some explanation I logged as SangeetC (on 06-Aug-2010)
* Test it in your environment before moving changes in Production.
Monday, August 31, 2009
[19] Need to Monitor Clarity Page loads (Performance) ?
There is often a need to know how long it takes to load the page. At least my testing team needs it... to benchmark the performance time to time. So far windows time or wrist watch or Cell phone's stopwatch came to rescue..
I have been using a Firefox Add-on to give me the page load times. It's "Extended Statusbar" that I use to know page load times. You can download (in Firefox) or search for "Extended Statusbar" in Firefox > Tools Add-ons > Get Add-ons > Search box.
Only thing this Add-on will not show accurate time for the portlets which uses AJAX based "Progress-bars" while loading the data.
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.
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.
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.
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.
* 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.
Saturday, March 7, 2009
[14] Tracking Database schema changes (Oracle Only)
I needed to track Niku Schema changes and to have audit in place to track what got changed, when and by whom... I researched and got one method to track DB Schema changes on Production database, that I would like to share with you .. ( Remember this is all about Schema changes like SP, Triggers, Functions etc and not the data changes in Tables )
This method is about creating a 'Niku' Schema level trigger and that trigger inserting the change details in a Table. You can download code from here. If you have Niku user's password then it will do the job. I recommend, trying it on Dev/Test first and exclude events/records that you don't want to track in first IF condition of Trigger. It will give you Object name, date when changed/created, Terminal, OS User and other few details. It also stores the DDL of the object before it was changed ( in BeforeDDL field ) so you can track the changes for any object ( SP/Trigger/Function etc ). BeforeDDL field will show up the contents when you doubleclick it .. (in Toad)
Sometimes you may need to compare the contents of say a SP. I prefer using CompFold utility for content comparison that you can download from here . Save contents to file and then compare using CompFold ( or any other comparison tool of your choice )
Note : Disable this Trigger while doing upgrade or applying Service Pack (FP).
This method is about creating a 'Niku' Schema level trigger and that trigger inserting the change details in a Table. You can download code from here. If you have Niku user's password then it will do the job. I recommend, trying it on Dev/Test first and exclude events/records that you don't want to track in first IF condition of Trigger. It will give you Object name, date when changed/created, Terminal, OS User and other few details. It also stores the DDL of the object before it was changed ( in BeforeDDL field ) so you can track the changes for any object ( SP/Trigger/Function etc ). BeforeDDL field will show up the contents when you doubleclick it .. (in Toad)
Sometimes you may need to compare the contents of say a SP. I prefer using CompFold utility for content comparison that you can download from here . Save contents to file and then compare using CompFold ( or any other comparison tool of your choice )
Note : Disable this Trigger while doing upgrade or applying Service Pack (FP).
Friday, March 6, 2009
[13] Clarity SQL Trace Tip
Clarity SQL Trace thing I often do and mostly to know which Query is performing badly and eating up most chunk of Execution time... For short SQL Trace files it's easy to locate but for some when file runs over 400 kb or so then Grrrrr..... Keep scrolling and scrolling..
Here is tip that can you use to avoid those 'scrolls' ... I use Textpad ( though you can use others ones too that support Regular Expression search ) for searching the SQL's that takes longer time. In Textpad check "Regular Expressions" and search for Time: [0-9][0-9][0-9][0-9] This will highlight the ones which takes over 1 sec, if you want to locate the ones which takes over 10 seconds then add another [0-9] in above expression.
Here is tip that can you use to avoid those 'scrolls' ... I use Textpad ( though you can use others ones too that support Regular Expression search ) for searching the SQL's that takes longer time. In Textpad check "Regular Expressions" and search for Time: [0-9][0-9][0-9][0-9] This will highlight the ones which takes over 1 sec, if you want to locate the ones which takes over 10 seconds then add another [0-9] in above expression.
[12] Quick DB Sync between Clarity environments (Oracle Only)
Many a times, I need to Take Production copy and replicate to some other environment to make it Production like. My pain that Export to be done strictly in off peak hours and it's Long process, takes hours and the Exp dmp file is too big to transfer and then import also eating up lots of disk space. Reason : Slices and Datamart tables are quite huge ones and makes this thing crazy.
In my case it was OK not to have Slices & Datamart tables Synch'd. So I thought if we can Exp & Imp all tables except Slices & datamart ones. I researched a bit and came up with a approach that would give me just what I wanted. In my case, Export was done in 20 minutes. File size was 2.2 GB ( when zipped it was 240 MB ). It was easy to transfer 240 mb file to different server and next 38 minutes to import into target database. CMN_CAPTIONS_NLS was largest table with 3.3 million records.
I have documented the complete process that I did. You can download from here. I am not database expert so not sure if there is any better way of doing it. May be if someone has better approach or suggesitons, please leave comment for this Post.
* I see another benefit with this approach. Apart from the backups that DBA has scheduled and goes into tape, I can schedule Exp job on another server which can keeps DMP of last 15 days. Typically backup of all those 15 days will not take more than 50 GB of space. And when needed you can get any of those 15 versions in very quick time ( as compared to Tape to be brought from different physical location, restored on separate server which typically takes 2 days)
In my case it was OK not to have Slices & Datamart tables Synch'd. So I thought if we can Exp & Imp all tables except Slices & datamart ones. I researched a bit and came up with a approach that would give me just what I wanted. In my case, Export was done in 20 minutes. File size was 2.2 GB ( when zipped it was 240 MB ). It was easy to transfer 240 mb file to different server and next 38 minutes to import into target database. CMN_CAPTIONS_NLS was largest table with 3.3 million records.
I have documented the complete process that I did. You can download from here. I am not database expert so not sure if there is any better way of doing it. May be if someone has better approach or suggesitons, please leave comment for this Post.
* I see another benefit with this approach. Apart from the backups that DBA has scheduled and goes into tape, I can schedule Exp job on another server which can keeps DMP of last 15 days. Typically backup of all those 15 days will not take more than 50 GB of space. And when needed you can get any of those 15 versions in very quick time ( as compared to Tape to be brought from different physical location, restored on separate server which typically takes 2 days)
Sunday, February 1, 2009
[11] ASP.NET Calling Clarity's Query Web Service
Here is an Example of ASP.NET calling Clarity's Query Web Service. This is useful in scenarios like .NET app wants to get Resource OBS by supplying ResourceID or say want to get Team member listing by passing in Projet ID...
Lets see first how it works...
1. Clarity creates a Web Service when a query is created. (Interesting.. Isn't it ?)
2. Any other system (.NET, Java, others ) can access this query and get data from Clarity. (if it knows Clarity login/pwd)
3. External System can supply Query Filter Criteria and get "Filtered" data from that query.
I am taking a simple example where .NET app will pass "user name" to Clarity and will in turn receive "Resource Manager". Here are the steps :
Step 1 : Create NSQL Query (QueryID = "res_manager") with two columns User Name and Resource Manager.
Step 2 : Create .NET Application, Add Web Reference to http://localhost/niku/wsdl/Query/res_manager Set Web Reference name say Q
Step 3 : Create a Webform and add Textbox to it named say TextBox1
Step 4 : Add following code in Page/Form load or under a button
------------------------------------------------------------------------
Dim QS As New Q.res_managerQueryService
Dim Q As New Q.res_managerQuery
Dim Auth As New Q.Auth
Dim Log As New Q.Login
Dim ClaritySessionID As String
Log.Username = "admin"
Log.Password = "clarity"
ClaritySessionID = QS.Login(Log)
Auth.SessionID = ClaritySessionID
Dim F As New Q.res_managerFilter
Dim QueryResult As New Q.res_managerQueryResult
Dim Rec As New Q.res_managerRecord
QS.AuthValue = Auth
Q.Code = "res_manager"
F.user_name = "jsmith"
Q.Filter = F
QueryResult = QS.Query(Q)
TextBox1.Text = QueryResult.Records(0).resource_manager_id
QS.Logout(ClaritySessionID)
--------------------------------------------------------------------------
* This example above would return only one Record as desired. For instances where multiple records are expected, you would need to loop though QueryResult.Records and get field elements.
** "MS Visual Web Developer 2008 Express Edition" is free to download..
Lets see first how it works...
1. Clarity creates a Web Service when a query is created. (Interesting.. Isn't it ?)
2. Any other system (.NET, Java, others ) can access this query and get data from Clarity. (if it knows Clarity login/pwd)
3. External System can supply Query Filter Criteria and get "Filtered" data from that query.
I am taking a simple example where .NET app will pass "user name" to Clarity and will in turn receive "Resource Manager". Here are the steps :
Step 1 : Create NSQL Query (QueryID = "res_manager") with two columns User Name and Resource Manager.
Step 2 : Create .NET Application, Add Web Reference to http://localhost/niku/wsdl/Query/res_manager Set Web Reference name say Q
Step 3 : Create a Webform and add Textbox to it named say TextBox1
Step 4 : Add following code in Page/Form load or under a button
------------------------------------------------------------------------
Dim QS As New Q.res_managerQueryService
Dim Q As New Q.res_managerQuery
Dim Auth As New Q.Auth
Dim Log As New Q.Login
Dim ClaritySessionID As String
Log.Username = "admin"
Log.Password = "clarity"
ClaritySessionID = QS.Login(Log)
Auth.SessionID = ClaritySessionID
Dim F As New Q.res_managerFilter
Dim QueryResult As New Q.res_managerQueryResult
Dim Rec As New Q.res_managerRecord
QS.AuthValue = Auth
Q.Code = "res_manager"
F.user_name = "jsmith"
Q.Filter = F
QueryResult = QS.Query(Q)
TextBox1.Text = QueryResult.Records(0).resource_manager_id
QS.Logout(ClaritySessionID)
--------------------------------------------------------------------------
* This example above would return only one Record as desired. For instances where multiple records are expected, you would need to loop though QueryResult.Records and get field elements.
** "MS Visual Web Developer 2008 Express Edition" is free to download..
Saturday, December 6, 2008
[10] Sanitize XOG XML file before pushing to Clarity
At several ocassions while XOG'ing between environments, you face an issue of XOG returning an error because of special characters inside the XOG XML file being pushed. Mostly these are special characters that XOG doesn't like and those are mostly not detected via Visual inspection. For quite some time, I have been using simple but effective method to Remove those special characters from XOG file(s).
Step 1 : Open XOG file in TextPad (or any Text editor supporting Regular Expression Search/Replace feature)
Step 2 : Press F8 to open Replace window and Do Find/Replace as :-
Find : [^&;:()a-zA-Z0-9" =./><_-~-]
Note : If you find any other character which should be there but found in search, include in above expression after &. Be careful if you are choosing "Replace All" option as you may blank out character(s) which were actually needed to be XOG file. Secondly, if you have many files to 'Sanitize' then load all those document in Textpad and set the 'Scope' to 'All documents' in Find/Replace search dialog box.
As per Martti's question/suggestion I am sharing method for removing Non-English Language codes from XOG file.
Step 1 : In Textpad > Configure > Preferences .. > Editor > Check "Use POSIX Regular Expression Syntax"
Step 2 : Search and Replace blank for .*<nls.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in Single line)
Step 3 : Search and Replace blank for .*<nls.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 2 lines)
Step 4 : Search and Replace blank for .*<nls.*\n.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 3 lines)
To Test you can try this sample XOG file. These regular expression examples above are for "en" languageCode and include/exclude other Language codes by making changes in above regular expressions. Explaining these expression would be lengthy so just leave your comments if you have any specific question or need, I would reply your queries.
Step 1 : Open XOG file in TextPad (or any Text editor supporting Regular Expression Search/Replace feature)
Step 2 : Press F8 to open Replace window and Do Find/Replace as :-
Find : [^&;:()a-zA-Z0-9" =./><_-~-]
Note : If you find any other character which should be there but found in search, include in above expression after &. Be careful if you are choosing "Replace All" option as you may blank out character(s) which were actually needed to be XOG file. Secondly, if you have many files to 'Sanitize' then load all those document in Textpad and set the 'Scope' to 'All documents' in Find/Replace search dialog box.
As per Martti's question/suggestion I am sharing method for removing Non-English Language codes from XOG file.
Step 1 : In Textpad > Configure > Preferences .. > Editor > Check "Use POSIX Regular Expression Syntax"
Step 2 : Search and Replace blank for .*<nls.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in Single line)
Step 3 : Search and Replace blank for .*<nls.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 2 lines)
Step 4 : Search and Replace blank for .*<nls.*\n.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 3 lines)
To Test you can try this sample XOG file. These regular expression examples above are for "en" languageCode and include/exclude other Language codes by making changes in above regular expressions. Explaining these expression would be lengthy so just leave your comments if you have any specific question or need, I would reply your queries.
Sunday, November 30, 2008
[9] Admin Logging in as Different user
This one is my favorite ...
Many a times it is needed that 'Admin' ( or Support Staff ) needs to login as different user in Clarity. Primarily it's Support/Admin person's perspective to login as User who is facing some issue(s) and attempt to resolve it. So far it has been bit lengthy process of Disabling the ldap and changing the password of user in database and reverse the process after 'troubleshooting' is done.
I faced this problem initially ( after my bootcamp ) and thought to evolve a easy solution where 'Admin' should be able to log in as any user with ease.. Many thoughts came in mind like creating a SP based Clarity job or a Web page to creating a user Session through Web service and redirect to Overview page using that Session ID and many others... but then finally came up with workaround which according to me was less hassle when compared to other ones...
Workaround : Admin user ( cmn_sec_users.user_name = 'admin' ) can now login as other user ( say williamR ) from Clarity Login page itself. What Admin user would need to do is simple... In Login field ( of Clarity login page ) type Admin/williamR and supply Admin's own password ( Like Screenshot below ) and Hit 'Login' button to login as williamR user.
Solution : Download. This zip file contains instruction for Both SQL Server and Oracle based Clarity instances. Take the backup of the file which is being changed to some safe location, should there be need to revert for any reasons. ( I have tested it on Clarity 7.5.x, 8.x & 12.x versions )
* Post your comments or email the blog's email id, if you face any issues or this doesn't work for you.
Many a times it is needed that 'Admin' ( or Support Staff ) needs to login as different user in Clarity. Primarily it's Support/Admin person's perspective to login as User who is facing some issue(s) and attempt to resolve it. So far it has been bit lengthy process of Disabling the ldap and changing the password of user in database and reverse the process after 'troubleshooting' is done.
I faced this problem initially ( after my bootcamp ) and thought to evolve a easy solution where 'Admin' should be able to log in as any user with ease.. Many thoughts came in mind like creating a SP based Clarity job or a Web page to creating a user Session through Web service and redirect to Overview page using that Session ID and many others... but then finally came up with workaround which according to me was less hassle when compared to other ones...
Workaround : Admin user ( cmn_sec_users.user_name = 'admin' ) can now login as other user ( say williamR ) from Clarity Login page itself. What Admin user would need to do is simple... In Login field ( of Clarity login page ) type Admin/williamR and supply Admin's own password ( Like Screenshot below ) and Hit 'Login' button to login as williamR user.
Solution : Download. This zip file contains instruction for Both SQL Server and Oracle based Clarity instances. Take the backup of the file which is being changed to some safe location, should there be need to revert for any reasons. ( I have tested it on Clarity 7.5.x, 8.x & 12.x versions )
* Post your comments or email the blog's email id, if you face any issues or this doesn't work for you.
Thursday, November 27, 2008
[8] CA World 2008
Thanks for Attending my Session on "Integration with Clarity using Web Services" at CA World 08 at Las Vegas.
For those who attended, Here is the code that I used in Live Demo. This basically tells the steps to follow if you want to call an External Web Service from Clarity (Say Google's Search Web Service ) using GEL Scripts.
In this Example, A Custom Object instance is created and any google Search string is provided in "Name" field of the instance. When Save/Submit is clicked, a Process runs which calls a Gel script. Gel Script then calls Google Web Service and gets the data in XML format. Gel Script breaks the XML, Loops through, extracts required data elements, stores them in variables and then finally Inserts them into a Custom Table. Portlet is created and NSQL query based on that Custom Table displays the Google Search Result data.
In this Example, for simplicity Google Search Web Service is used, but in Real life scenarios you can pull Stock/Currency Exchange etc information on Periodic basis through Clarity job. Likewise you can also pull and use other Web Services provided by Internal applications like SAP, .NET/Java Applications, CA Service Desk, HR/Asset Management applications or product Suites.
In similar fashion, Other Internal Apps can also access Clarity's data through Web service. Clarity exposes it's Web Services at http://clarity-server-name/niku/xog that others can use.
Post a comment or mail me if you need some other/related examples or have any specific query.
Friday, August 29, 2008
[7] ASP.NET Calling Clarity Web Services - Code Example
Here is an Example of ASP.NET calling Clarity Web Services ( Here ASP.NET Calls Project XOG to get properties of a Particular Project )
Steps :-
1. Add Web reference http://localhost/niku/wsdl/Object/Projects and name it as PRJ
2. Create a New "ASP.NET Web application Project". Create a Multiline Textbox in it say Textbox1 ( To display XOG output )
3. On the PageLoad event add following :-
Dim PS As New PRJ.ProjectsService
Dim Log As New PRJ.Login
Dim Auth As New PRJ.Auth
Dim SoapXML As New System.Xml.XmlDocument
Dim DataBus As System.Xml.XmlElement
Dim XOGOutput As System.Xml.XmlElement
Dim sessionId As String
Log.Password = "admin"
Log.Username = "admin"
sessionId = PS.Login(Log)
Auth.SessionID = sessionId
PS.AuthValue = Auth
SoapXML.Load("c:\xog\Read_project.xml")
XOGOutput = PS.ReadProject(SoapXML.DocumentElement)
TextBox1.Text = XOGOutput.InnerXml
PS.Logout(sessionId)
4. Read_Project.xml looks like as below :-
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
<!-- you change the order by simply swap 1 and 2 number in the name attribute -->
<args name="order_by_1" value="name"/>
<args name="order_by_2" value="projectID"/>
<args name="include_tasks" value="false"/>
<args name="include_resources" value="false"/>
<args name="include_custom" value="false"/>
<args name="include_dependencies" value="false"/>
</Header>
<Query>
<Filter name="projectID" criteria="EQUALS">Clarity_test</Filter>
</Query>
</NikuDataBus>
------------------------------------------------------------------------------
* This was tested on Clarity 7.5.3.
Steps :-
1. Add Web reference http://localhost/niku/wsdl/Object/Projects and name it as PRJ
2. Create a New "ASP.NET Web application Project". Create a Multiline Textbox in it say Textbox1 ( To display XOG output )
3. On the PageLoad event add following :-
Dim PS As New PRJ.ProjectsService
Dim Log As New PRJ.Login
Dim Auth As New PRJ.Auth
Dim SoapXML As New System.Xml.XmlDocument
Dim DataBus As System.Xml.XmlElement
Dim XOGOutput As System.Xml.XmlElement
Dim sessionId As String
Log.Password = "admin"
Log.Username = "admin"
sessionId = PS.Login(Log)
Auth.SessionID = sessionId
PS.AuthValue = Auth
SoapXML.Load("c:\xog\Read_project.xml")
XOGOutput = PS.ReadProject(SoapXML.DocumentElement)
TextBox1.Text = XOGOutput.InnerXml
PS.Logout(sessionId)
4. Read_Project.xml looks like as below :-
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
<!-- you change the order by simply swap 1 and 2 number in the name attribute -->
<args name="order_by_1" value="name"/>
<args name="order_by_2" value="projectID"/>
<args name="include_tasks" value="false"/>
<args name="include_resources" value="false"/>
<args name="include_custom" value="false"/>
<args name="include_dependencies" value="false"/>
</Header>
<Query>
<Filter name="projectID" criteria="EQUALS">Clarity_test</Filter>
</Query>
</NikuDataBus>
* This was tested on Clarity 7.5.3.
Friday, July 25, 2008
[6] SQL Server 2005 configuration for Clarity
SQL Server 2005 Database configuration for Clarity :-
1. Login as sa
2. [ For 8.1 and below only ] Databases > New Database > Database Name : Niku > Options > Compatibility Level : SQL Server 2000 (80) ( Check installation Guide to confirm compatibility level for the version being installed )
3. Security > Create Login > niku ( Select SQL Server Login and give niku password )
4. Database > Niku > Security > Users > Create User > user Name : niku ; Login : niku
5. Database > Niku > Security > Schema > Create Schema > Schema Name : niku ; Schema Owner : niku
6. Security > Logins > Niku > Properties > User Mapping > Select Niku database Row > For Niku Database change 'Default Schema' to niku > In Below Pane check the role membership for 'db_owner'. 7. In Master database execute following commands :
ALTER DATABASE niku SET ARITHABORT ON
ALTER DATABASE niku SET ANSI_NULLS ON
ALTER DATABASE niku SET QUOTED_IDENTIFIER ON
ALTER DATABASE niku SET READ_COMMITTED_SNAPSHOT ON
GRANT VIEW SERVER STATE to niku
8. Install database from Clarity NSA.
* If you are restoring SQL Server database from Backup then run following command to fix niku login. (If there are more database users repeat this command for each user)
sp_change_users_login 'Auto_fix' , 'niku'
1. Login as sa
2. [ For 8.1 and below only ] Databases > New Database > Database Name : Niku > Options > Compatibility Level : SQL Server 2000 (80) ( Check installation Guide to confirm compatibility level for the version being installed )
3. Security > Create Login > niku ( Select SQL Server Login and give niku password )
4. Database > Niku > Security > Users > Create User > user Name : niku ; Login : niku
5. Database > Niku > Security > Schema > Create Schema > Schema Name : niku ; Schema Owner : niku
6. Security > Logins > Niku > Properties > User Mapping > Select Niku database Row > For Niku Database change 'Default Schema' to niku > In Below Pane check the role membership for 'db_owner'. 7. In Master database execute following commands :
ALTER DATABASE niku SET ARITHABORT ON
ALTER DATABASE niku SET ANSI_NULLS ON
ALTER DATABASE niku SET QUOTED_IDENTIFIER ON
ALTER DATABASE niku SET READ_COMMITTED_SNAPSHOT ON
GRANT VIEW SERVER STATE to niku
8. Install database from Clarity NSA.
* If you are restoring SQL Server database from Backup then run following command to fix niku login. (If there are more database users repeat this command for each user)
sp_change_users_login 'Auto_fix' , 'niku'
Tuesday, July 22, 2008
[5] Change default Timezone
Sometimes it is required to change the "Default timezone" of Resources when they are added through Studio or XOG/WebServices. Here is the way :-
Step 1 : Open C:\Niku\Clarity\config\i18n.xml
Step 2 : Change defaultTimeZoneId at Line #3
Tip : To find the timezone code, Open Account Settings page in Clarity and find it by looking into HTML Source of the webpage..
Note : Changes may need to re-applied after any Fixpack or version upgrade..
Step 1 : Open C:\Niku\Clarity\config\i18n.xml
Step 2 : Change defaultTimeZoneId at Line #3
Tip : To find the timezone code, Open Account Settings page in Clarity and find it by looking into HTML Source of the webpage..
Note : Changes may need to re-applied after any Fixpack or version upgrade..
[4] IE Developer Toolbar - A must have
Microsoft IE Developer Toolbar is great tool when it comes to Clarity Development & Support. I use it quite frequently primarily to identify Display field's internal database name, find lookup name, lookup values etc.. It eliminates the need of doing "view source" of Web page and digging into HTML code to extract relevant info ..
Step 1 : Install Microsoft IE Toolbar and it will added as add-in in IE.
Step 2 : Open any Clarity page.
Step 3: Click on IE Toolbar icon in toolbar (It shows up in lower pan)
Step 4: Click Find > 'Select Element by Click'
Step 5: Click on desired display field and it will show it's internal name.
Step 6. After having done with that Click Find > 'Select Element by Click' option to uncheck it (This will return webpage to normal display mode)
Tip : You can also click the first icon in place of Find > 'Select element by click'
Step 1 : Install Microsoft IE Toolbar and it will added as add-in in IE.
Step 2 : Open any Clarity page.
Step 3: Click on IE Toolbar icon in toolbar (It shows up in lower pan)
Step 4: Click Find > 'Select Element by Click'
Step 5: Click on desired display field and it will show it's internal name.
Step 6. After having done with that Click Find > 'Select Element by Click' option to uncheck it (This will return webpage to normal display mode)
Tip : You can also click the first icon in place of Find > 'Select element by click'
Monday, July 21, 2008
[3] Display logged in user name in Clarity Studio
Displaying logged in user name in Clarity Studio is a kludge. Implementing it in 8.1 is different than in 7.5.x. User Name can be displayed on top of Left Menu Navigation bar. Lets see how they can be implemented in both 7.5.x and 8.1 :-
Clarity 7.5.x
--------------
Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------
Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-
Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Clarity 7.5.x
--------------
Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------
Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-
Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Sunday, July 20, 2008
[2] Secrets behind debug=1
Ever tried appending &debug=1 to Clarity URL in Web browser's address bar.. If not yet done, just try and see what it brings for you ...
Like appending it to Project Listing URL you see something like below (Click image to Enlarge) :-
* I sometimes use it for XML level debugging/research activity. Like which queries are being fired, which XML or Java modules are called by any particular action or while displaying a page. Here in this debug page we can get some unique keywords and search it in META-INF or Webroot folder files. This sometimes helps in reaching to page/module which is controlling Clarity action/page. From there you can dig into XML/XBL/XSL files and get the logic there..
Like appending it to Project Listing URL you see something like below (Click image to Enlarge) :-
This is for 8.1 while 7.5.x output will not be that elaborative. Using debug=1 option you can see XML version of that Clarity page. In 8.1 you will also see list of Rights user have for that object/portlet. Like you can know whether user has "Create Project" rights or not, what are the hidden values in the page that you don't see on the screen...
You will also find internal id's of portlets, objects etc which you may like to query in database... similarily there are many more pieces of information that you can use to troubleshoot technical issues.* I sometimes use it for XML level debugging/research activity. Like which queries are being fired, which XML or Java modules are called by any particular action or while displaying a page. Here in this debug page we can get some unique keywords and search it in META-INF or Webroot folder files. This sometimes helps in reaching to page/module which is controlling Clarity action/page. From there you can dig into XML/XBL/XSL files and get the logic there..
Saturday, July 19, 2008
[1] Clarity 8.1 on Weblogic 9.2 Walkthrough
Here is Clarity 8.1 on Weblogic 9.2 installation walkthrough. A Powerpoint presentation containing following contents..
• Clarity installation.
• WebLogic Configuration
• Deployment of Clarity .ear files to WebLogic
• Appendix (Things to know, Tips, Best Practices, Troubleshooting)
Click here to download the PPT file...
* I was installing it first time and had very basic document in hand which was based on Weblogic 8.x. After having spent almost 2 days on this, I was still not able to bring up Clarity app home page. (though NSA deployment was success). Everytime deployment of jar file took considerable time (10-15 mins) and different combinations were yielding different errors. Googled a lot, tried many options... but still far from success. I was trying with SQL Server 2005. Next morning I started it on this again .. Thought of giving try with Oracle 10g ... and Voila .. it was SUCCESS... I digged back to SQL Server 2005 setup and discovered that it was driver issue (see Appendix section of PPT file for details). I must thank to this driver issue, otherwise I couldn't have learned many other things. I mentioned most of those learnings in Appendix section, don't miss that. Rather I would suggest to have quick look at that before starting installation..
• Clarity installation.
• WebLogic Configuration
• Deployment of Clarity .ear files to WebLogic
• Appendix (Things to know, Tips, Best Practices, Troubleshooting)
Click here to download the PPT file...
* I was installing it first time and had very basic document in hand which was based on Weblogic 8.x. After having spent almost 2 days on this, I was still not able to bring up Clarity app home page. (though NSA deployment was success). Everytime deployment of jar file took considerable time (10-15 mins) and different combinations were yielding different errors. Googled a lot, tried many options... but still far from success. I was trying with SQL Server 2005. Next morning I started it on this again .. Thought of giving try with Oracle 10g ... and Voila .. it was SUCCESS... I digged back to SQL Server 2005 setup and discovered that it was driver issue (see Appendix section of PPT file for details). I must thank to this driver issue, otherwise I couldn't have learned many other things. I mentioned most of those learnings in Appendix section, don't miss that. Rather I would suggest to have quick look at that before starting installation..
Subscribe to:
Posts (Atom)