Saturday, May 21, 2011

CRM On Demand: How to highlight records in a list ?.

Many of us use lists in Oracle CRM On Demand. It makes our life simple. Records are displayed in the list based on predefined criteria and we can scroll through the list of records and work on them as required. When we hover on the list, the rows are automatically highlighted.

What if we have more records come up on a list ? Without a visual indicator one would not know what records were previewed. It will be nice to have the row highlighted, once the record is previewed, isn't it ? I came across this interesting problem some time back and thought it would be useful to share the solution I designed.

Below is a screen shot of a sample list, if you click on individual rows, the row should be highlighted till the screen is refreshed (this is the requirement)




Below is a screen shot of  how a list would look like after couple of records were previewed and clicked.



Wondering how to do it ? :) I did have to break my head a bit to get the JavaScript working, but now that its working, one can make use of this and accomplish this requirement. Below are few simple steps that explains how to do it..

1) Create a new web applet by navigating to Admin > Application Customization > Global web applet.
Set the parameters as shown in the below screen shot.



2) Paste the below JavaScript in the Web Applet HTML text box.

<script>
ListDecorMgr.attachTREvt=function(tr){
   tr.onmouseover = null;
   tr.onmouseout = null;
   tr.onclick = ListDecorMgr.hiLiteTR;
}


ListDecorMgr.doHilite = function(tr){
   if (tr!=null && !isUndefined(tr) && (isUndefined(tr._savedBGColor) || tr._savedBGColor == null)){
   
      // Set color code here
      tr._savedBGColor = "#B3EDFF";
      tr.style.backgroundColor = "#B3EDFF";


      ListDecorMgr.hlTR.push(tr);
   }
   ListDecorMgr.clearTimer();
}


ListDecorMgr.hiLiteTR = function(evt){
var tr=this;
ListDecorMgr.doHilite(tr);
}
</script>

3) Add the new web applet to your action bar layout by navigating to My Setup > Personal Layout > Action Bar Layout.

4) Access a sample list by navigating to Accounts Tab > My Accounts List, or any of your favorite lists in the application and click on individual rows. You will see that the rows will be highlighted and will stay till the screen is refreshed :)

Note: Do test this on your staging environment ! before you put it on your live instance !

Hope you liked it ! Do share your thought and comments.




Do like us on our Facebook Page:


5 comments:

  1. This is a nice little feature! One question: I implemented this in my CTE and was looking at a list of records. It appears that the functionality only works when I stay on that list. If I try and click into a record, then return to the list, the highlighting is gone. Is there something I need to review or is this is expected behavior?

    ReplyDelete
  2. This is the expected behavior, the highlighting will be gone if the screen is refreshed.

    ReplyDelete
  3. Do you know any java tricks that can change the labels within the address box area. For example the labels that are used in the contact address area?

    ReplyDelete
  4. Nice!! that is really neat.. even if it only works upto a refresh point it is still very helpful.... keep it up

    ReplyDelete
  5. Hello Dharmasagar,
    I came across this blog and was wondering if you could help me with a java script that converts text to Upper case. I copied a snippet of the code from TTOCOD(Mathie Emanuelli) 's book but its not working right. When I add this code, the text appears in upper case but when it gets saved it going back to the way it was typed. Any help????

    ReplyDelete