Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Hide Tab Before Record is Saved - JScript - CRM Online

$
0
0

Hi,

Requirement:  If record is not saved, the xyz Tab (name = tab_3) should be invisible. The tab should be visible after the record is saved.

I am not programmer and don not know much about JScript, so I carefully read many codes suggested in different posts here and came up with this one. It is added in form as OnLoad event:

// If records is not created,

//    then Hide the Submit Claim tab

// Otherwise,

//    Show the Submit Claim tab

function OnLoad() {

   ShowHide();

}

function ShowHide() {

   if (Xrm.Page.getAttribute("createdon").getValue() == null) {

       Xrm.Page.ui.tabs.get("tab_3", "collapsed", false).setVisible(false);

   }

   else {

       Xrm.Page.ui.tabs.get("tab_3", "expanded", true).setVisible(true);

   }

}

1. Can this code be improved.  If yes, please advise how

2. Is the 'Created On' appropriate in IF statement or can this be replaced with something better?

3. When I open a new form, the tab appears for 2-3 seconds and then it is hides.  How this delay can be eliminated?

4. Should this code also be added in the events of tab itself?

If there is an article or blog which show how to meet a similar requirement, please suggest that too.

Thanks in advance,

Saima


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>