Hi,
I am not sure how it is working. You are missing Account Type = Construction check condition in your code.
As per your comment - //show Construction tab if the Account Type = Construction and the Sub Type = Public
but in your check condition you are only checking subtype
if (SubTypeValue != null && SubTypeValue == 3) {
I hope this is not intentional and happened by mistake.
Now coming to your original question where you would like to add another codnition to show Public tab - I have modified your code as below, please try this -
function Industry(executionContext) {
var formContext=executionContext.getFormContext();
//show Construction tab if the Account Type = Construction and the Sub Type = Public
var AccountTypeValue = formContext.getAttribute("accountypecode").getValue();
var SubTypeValue = formContext.getAttribute("grey_subtype").getValue();
var industrytab = formContext.ui.tabs.get("IndustryTab");
var publictab = formContext.ui.tabs.get("PublicTab");
if (SubTypeValue != null && SubTypeValue == 3) {
//show the section
industrytab.setVisible(true);
// Hide Public Tab
publictab.setVisible(false);
}
else if(AccountTypeValue!=null && AccountTypeValue==Specify Public Optionset valie)
{
industrytab.setVisible(false);
publictab.setVisible(true);
}
else {
//hide the section
industrytab.setVisible(false);
publictab.setVisible(false);
}
}
You are also missing 't' in accountypecode field schema name. Please verify this anfd fix your schema name.
Make sure to select pass execution context as first parameter when you register your event handler.

Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/