Hello all,
I want to Hide 'Part Goal' tab in 'Part' ItemType for all except one group of Identity.
Only for 'Sourcing Identity' Group 'Part Goal' should be visible not to others. How to achieve this???
Regards,
Sherene
Hello Sherene
you have 2 things to do (1) decide if the current user is a member of Sourcing Identity, and (2) then hide the tab.
I normally do this business logic on a Form OnPopulate Event, calling a JS Method. Here is a sample Method that is hiding some Tabs, based on the Lifecycle State. use this as an example of #2. There is an IOM call to get te list of Identities that the current user is a member of (not used in this example, but I will look for a sample for you).
------------------------------------------------------------------------------------------------------------------------------------------
// called from Account Form, when the status of Account!="Partner"// want to disable tabs that don't apply//// 09.09.2009 peter using the TechNote How To Hide RelationshipTab baed on Business logic// 09.16.2009 peter all 4 Partner states get the Partner-Info tab. Partner gets the Sub-Partners tab// 11.09.2009 peter add the Purchase Orders and Subscriber Info tabs to the List////=======================================================================================================
top.hidePartTabsByBusinessLogic = function() { // If the tabbar is not yet ready, wait a bit and call the function recursively if (!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") === "" ) { setTimeout("top.hidePartTabsByBusinessLogic();", 30); return; } // Get the value of the classification property from the form var thisStatus = new String(document.thisItem.getProperty("state","")); var tabbar = parent.relationships.relTabbar; var tabID = null; if (thisStatus == "Partner" || thisStatus =="Potential Partner" || thisStatus =="Partner, Sub" || thisStatus =="Partner, Inactive" ) { // do nothing //return; } else { tabID = tabbar.GetTabId("Partner Info"); if (tabID) { tabbar.SetTabVisible(tabID,false); } } if (thisStatus == "Partner" ) { // do nothing //return; } else { tabID = tabbar.GetTabId("Sub Partners"); if (tabID) { tabbar.SetTabVisible(tabID,false); } } if (thisStatus == "Customer" || thisStatus =="Subscriber" ) { // do nothing //return; } else { tabID = tabbar.GetTabId("Subscriber Info"); if (tabID) { tabbar.SetTabVisible(tabID,false); } tabID = tabbar.GetTabId("Purchase Orders"); if (tabID) { tabbar.SetTabVisible(tabID,false); } } return;}; setTimeout("top.hidePartTabsByBusinessLogic();", 20);
-----------------------------------------------------------------------------------------------------------------------------------------------
Hello Peter,
Thanks so much for your quick reply.
I too have done the second part as you have mentioned.
top.hideTab = function(){
tabid
= tabbar.GetTabId("Expenses"); tabbar
tabbar
.SetTabVisible(tabid,false);
}}; setTimeout
setTimeout
("top.hideTab();", 30);
But I don't know how to check whether the curernt loggedin user is a member of that Identitiy using Client script.. If u could send some samples. It would eb of great help...
Thanks,
Here is a short JS Method example for testing if the Current User, is a member of a certain Group Identity.
-------------------------------------------------------------------------------------
// get the exploded list of Identities for the current uservar userIdentities = top.aras.getIdentityList(); // get the ID of the Identity we are checking forvar qry = this.newItem("Identity","get");qry.setattribute("select","id");qry.setProperty("name","Sourcing");qry = qry.apply();if (qry.isError() ) { alert(qry.getErrorDetail() ); return;}qry.getItemsByXPath("//Item[@type='Identity']");if (qry.getItemCount() ===0) { alert("No Identity named Sourcing is found"); return;}qry = qry.getItemByIndex(0);var targetID = qry.getID();
var i = userIdentities.indexOf(targetID);if (i == -1) { alert("This user is NOT in the Group Indentity"); return;}alert("Success - the user is in the Group Identity");