Skip to main content
14-Alexandrite
February 7, 2023
Solved

Hide Primary Content field in WTDocument subtype

  • February 7, 2023
  • 2 replies
  • 3541 views

Hello All,

 

I have a requirement where I have to hide the field Primary Content in the create and edit layout of WTDocument. I understand that it is not a part of PDM functionality but I would like to customize this and keep the primary content hidden in the form. Requesting you to shed some light on the options.

 

Thanks,

Sha

Best answer by Sha11

The below customization done in documentManagement.js took care of this requirement.

 

function updatePrimaryContent(value){

if(value == 'wt.doc.WTDocument|typeName of the Document'){
document.getElementById("primary0contentSourceList").selectedIndex = 0;
document.getElementById("templatePickerDiv").style.display = "none";
}
//This if will hide primary content selection block
if(value == 'wt.doc.WTDocument|typeName of the Document'){
var primaryContentContainer = null;
}
else{
var primaryContentContainer = document.getElementById('primaryContentPullDown');
}

//var primaryContentContainer = document.getElementById('primaryContentPullDown');
var keepCheckoutDiv = document.getElementById('checkboxkeepCheckedOutDiv');
var attrPanelDiv = document.getElementById('setAttributesTablePane');
var horizontalLine = document.getElementById('primaryContentHzLine');
var insertLocationPickerDiv = document.getElementById('insertLocationPickerDiv');

if(value!=''){
if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'visible';
}
if (keepCheckoutDiv != null){
keepCheckoutDiv.style.visibility = 'visible';
}
if (attrPanelDiv != ''){
attrPanelDiv.style.visibility = 'visible';
}
if (horizontalLine != ''){
horizontalLine.style.visibility = 'visible';
}
if (insertLocationPickerDiv != null) {
insertLocationPickerDiv.style.visibility = 'visible';
}
}else{
if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'hidden';
}
if (keepCheckoutDiv != null){
keepCheckoutDiv.style.visibility = 'hidden';
}
if (attrPanelDiv != ''){
attrPanelDiv.style.visibility = 'hidden';
}
if (horizontalLine != ''){
horizontalLine.style.visibility = 'hidden';
}
}

}

 

function displayPrimaryContent(){
//This block will hide file selection and file description in primary Content

var type = document.getElementById('createType').value;
if(type == 'wt.doc.WTDocument|documentType Name'){
hideElement('primaryFileWidgets');
hideElement('primaryURLWidgets');
hideElement('primaryExternalWidgets');
hideElement('primarySCMWidgets');

}

else{
var source;
var sourceList = document.getElementById('primary0contentSourceList');
var scmField = document.getElementById('scmHiddenField');
if( scmField != null && typeof scmField != 'undefined' )
manageSCMConent(sourceList);
if (sourceList!=null && typeof sourceList!= 'undefined' ){

source=sourceList.value;
}else{
return;
}

// then show whatever's appropriate
// ***MEC get strings from Java constants
if ( source=="URL" ) {
showElement('primaryURLWidgets');
} else if ( source=="EXTERNAL" ) {
showElement('primaryExternalWidgets');
} else if ( source=="CLEARCASE" ) {
showElement('primarySCMWidgets');
} else if ( source=="FILE" ) {
showElement('primaryFileWidgets');
}
}
}

2 replies

21-Topaz II
February 8, 2023

Hello Sha,

 

          Yes, it is not a part of the Windchill functionality and is not officially supported.

However, one file you probably want to do some experiment:  netmarkets/javascript/documentManagement.js

Sha1114-AlexandriteAuthor
14-Alexandrite
February 8, 2023

Been experimenting with the same file for the past 2 days, no luck so far.

HelesicPetr
22-Sapphire II
22-Sapphire II
February 8, 2023

Hi @Sha11 

@Joe_Sun give you good hint. 

You need to get selected type of WTDocument and basend on it show or hide the primary content panel

netmarkets/javascript/documentManagement.js

if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'visible';
}

change the visible to hidden

if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'hidden';
}

example with type control
		if (value=="YOURDOCTYPE")
		{
 if (primaryContentContainer != null){
 primaryContentContainer.style.visibility = 'hidden';
 }
		}else{
			if (primaryContentContainer != null){
 primaryContentContainer.style.visibility = 'visible';
 }

 

Then you need to preselect no content to achieve that wizard does not force you to select upload content. 

 

PetrH 

Sha1114-AlexandriteAuthorAnswer
14-Alexandrite
February 22, 2023

The below customization done in documentManagement.js took care of this requirement.

 

function updatePrimaryContent(value){

if(value == 'wt.doc.WTDocument|typeName of the Document'){
document.getElementById("primary0contentSourceList").selectedIndex = 0;
document.getElementById("templatePickerDiv").style.display = "none";
}
//This if will hide primary content selection block
if(value == 'wt.doc.WTDocument|typeName of the Document'){
var primaryContentContainer = null;
}
else{
var primaryContentContainer = document.getElementById('primaryContentPullDown');
}

//var primaryContentContainer = document.getElementById('primaryContentPullDown');
var keepCheckoutDiv = document.getElementById('checkboxkeepCheckedOutDiv');
var attrPanelDiv = document.getElementById('setAttributesTablePane');
var horizontalLine = document.getElementById('primaryContentHzLine');
var insertLocationPickerDiv = document.getElementById('insertLocationPickerDiv');

if(value!=''){
if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'visible';
}
if (keepCheckoutDiv != null){
keepCheckoutDiv.style.visibility = 'visible';
}
if (attrPanelDiv != ''){
attrPanelDiv.style.visibility = 'visible';
}
if (horizontalLine != ''){
horizontalLine.style.visibility = 'visible';
}
if (insertLocationPickerDiv != null) {
insertLocationPickerDiv.style.visibility = 'visible';
}
}else{
if (primaryContentContainer != null){
primaryContentContainer.style.visibility = 'hidden';
}
if (keepCheckoutDiv != null){
keepCheckoutDiv.style.visibility = 'hidden';
}
if (attrPanelDiv != ''){
attrPanelDiv.style.visibility = 'hidden';
}
if (horizontalLine != ''){
horizontalLine.style.visibility = 'hidden';
}
}

}

 

function displayPrimaryContent(){
//This block will hide file selection and file description in primary Content

var type = document.getElementById('createType').value;
if(type == 'wt.doc.WTDocument|documentType Name'){
hideElement('primaryFileWidgets');
hideElement('primaryURLWidgets');
hideElement('primaryExternalWidgets');
hideElement('primarySCMWidgets');

}

else{
var source;
var sourceList = document.getElementById('primary0contentSourceList');
var scmField = document.getElementById('scmHiddenField');
if( scmField != null && typeof scmField != 'undefined' )
manageSCMConent(sourceList);
if (sourceList!=null && typeof sourceList!= 'undefined' ){

source=sourceList.value;
}else{
return;
}

// then show whatever's appropriate
// ***MEC get strings from Java constants
if ( source=="URL" ) {
showElement('primaryURLWidgets');
} else if ( source=="EXTERNAL" ) {
showElement('primaryExternalWidgets');
} else if ( source=="CLEARCASE" ) {
showElement('primarySCMWidgets');
} else if ( source=="FILE" ) {
showElement('primaryFileWidgets');
}
}
}

HelesicPetr
22-Sapphire II
22-Sapphire II
February 22, 2023

This looks better 😄

function updatePrimaryContent(value){

 if(value == 'wt.doc.WTDocument|typeName of the Document'){
 document.getElementById("primary0contentSourceList").selectedIndex = 0;
 document.getElementById("templatePickerDiv").style.display = "none";
 }
//This if will hide primary content selection block
 if(value == 'wt.doc.WTDocument|typeName of the Document'){
 var primaryContentContainer = null;
 }
 else{
 var primaryContentContainer = document.getElementById('primaryContentPullDown');
 }

//var primaryContentContainer = document.getElementById('primaryContentPullDown');
 var keepCheckoutDiv = document.getElementById('checkboxkeepCheckedOutDiv');
 var attrPanelDiv = document.getElementById('setAttributesTablePane');
 var horizontalLine = document.getElementById('primaryContentHzLine');
 var insertLocationPickerDiv = document.getElementById('insertLocationPickerDiv');

 if(value!=''){
 if (primaryContentContainer != null){
 primaryContentContainer.style.visibility = 'visible';
 }
 if (keepCheckoutDiv != null){
 keepCheckoutDiv.style.visibility = 'visible';
 }
 if (attrPanelDiv != ''){
 attrPanelDiv.style.visibility = 'visible';
 }
 if (horizontalLine != ''){
 horizontalLine.style.visibility = 'visible';
 }
 if (insertLocationPickerDiv != null) {
 insertLocationPickerDiv.style.visibility = 'visible';
 }
 }else{
 if (primaryContentContainer != null){
 primaryContentContainer.style.visibility = 'hidden';
 }
 if (keepCheckoutDiv != null){
 keepCheckoutDiv.style.visibility = 'hidden';
 }
 if (attrPanelDiv != ''){
 attrPanelDiv.style.visibility = 'hidden';
 }
 if (horizontalLine != ''){
 horizontalLine.style.visibility = 'hidden';
 }
 }

}



function displayPrimaryContent(){
//This block will hide file selection and file description in primary Content

 var type = document.getElementById('createType').value;
 if(type == 'wt.doc.WTDocument|documentType Name'){
 hideElement('primaryFileWidgets');
 hideElement('primaryURLWidgets');
 hideElement('primaryExternalWidgets');
 hideElement('primarySCMWidgets');

 }

 else{
 var source;
 var sourceList = document.getElementById('primary0contentSourceList');
 var scmField = document.getElementById('scmHiddenField');
 if( scmField != null && typeof scmField != 'undefined' )
 manageSCMConent(sourceList);
 if (sourceList!=null && typeof sourceList!= 'undefined' ){

 source=sourceList.value;
 }else{
 return;
 }

// then show whatever's appropriate
// ***MEC get strings from Java constants
 if ( source=="URL" ) {
 showElement('primaryURLWidgets');
 } else if ( source=="EXTERNAL" ) {
 showElement('primaryExternalWidgets');
 } else if ( source=="CLEARCASE" ) {
 showElement('primarySCMWidgets');
 } else if ( source=="FILE" ) {
 showElement('primaryFileWidgets');
 }
 }
}
11-Garnet
April 28, 2023

I tried the same approach in my system. But i dont see any changes reflected. Can anyone guide through