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'

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..

[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'

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.

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) :-




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..