Skip to content

Commit acb068b

Browse files
khusmenoKubilay
andauthored
SQL_ObjectTemplates_WithMissingLocalization (#144)
Co-authored-by: Kubilay <khusmeno@khusmeno.com>
1 parent 4870e4d commit acb068b

2 files changed

Lines changed: 50 additions & 7 deletions

File tree

SCSM-Diagnostic-Tool/SourceCode/_1_Collecting/Collect_OnlyMgmtServerSpecificInfo/Collect_FromWFAndSecondary/Collect_SQL_MS_Specific.ps1

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,29 @@ order by 5 desc
610610
'@
611611

612612
$SQL_SCSM_MS['SQL_ObjectTemplates_WithMissingLocalizations']=@'
613-
--show Templates which do not have any localized string which would cause Connector (e.g. Exchange Connector) Wizard to crash (Bug 936430)
614-
select * from ObjectTemplate ot
615-
where not exists (select * from LocalizedText lt where ot.ObjectTemplateId = lt.LTStringId and LTStringType=1)
613+
--show IR,SR Templates which do not have any localized string and would therefore cause the Exchange Connector Wizard to crash (Bug 936430)
614+
select
615+
ObjectTemplateName as "Template Name to be edited"
616+
, ltMT.LTValue as BasedOnClass_DisplayName_ENU, ot.ManagementPackId
617+
from ObjectTemplate ot
618+
left join TypeProjection tp on ot.ObjectTemplateTypeId=tp.TypeProjectionId
619+
left join ManagedType mt on TypeProjectionSeed=mt.ManagedTypeId
620+
left join LocalizedText lt on ot.ObjectTemplateId = lt.LTStringId and lt.LTStringType=1 and lt.LanguageCode='ENU'
621+
left join LocalizedText ltMT on mt.ManagedTypeId = ltMT.LTStringId and ltMT.LTStringType=1 and ltMT.LanguageCode='ENU'
622+
left join LocalizedText ltTP on tp.TypeProjectionId = ltTP.LTStringId and ltTP.LTStringType=1 and ltTP.LanguageCode='ENU'
623+
where lt.ltvalue is null
624+
and mt.TypeName in ('System.WorkItem.Incident','System.WorkItem.ServiceRequest')
625+
union all
626+
select
627+
ObjectTemplateName as Template_Name, ltMT.LTValue as BasedOnClass_DisplayName_ENU, ot.ManagementPackId
628+
from ObjectTemplate ot
629+
inner join ManagedType mt on ot.ObjectTemplateTypeId=mt.ManagedTypeId
630+
left join LocalizedText lt on ot.ObjectTemplateId = lt.LTStringId and lt.LTStringType=1 and lt.LanguageCode='ENU'
631+
left join LocalizedText ltMT on mt.ManagedTypeId = ltMT.LTStringId and ltMT.LTStringType=1 and ltMT.LanguageCode='ENU'
632+
where ot.ObjectTemplateTypeId != '0814D9A7-8332-A5DF-2EC8-34D07F3D40DB' -- != System.Notification.Template.SMTP
633+
and lt.ltvalue is null
634+
and mt.TypeName in ('System.WorkItem.Incident','System.WorkItem.ServiceRequest')
635+
order by 1
616636
'@
617637

618638
$SQL_SCSM_MS['SQL_fn_GetEntityChangeLogGroomingWatermark']=@'
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
function Check_ObjectTemplates_WithNoLocalizations() {
22

33
$dataRow = GetEmptyResultRow
4-
$dataRow.RuleName="Templates with no localizations"
4+
$dataRow.RuleName="IR and SR Templates with no localizations"
55
$dataRow.RuleDesc=@"
6-
This rule checks if Templates exist that do not have any localized string. This would cause Connector (e.g. Exchange Connector) Wizard to crash the Console (bug 936430).
6+
This rule checks if Templates (only if based on Incident or Service Request) exist that do not have any localized Name or Description value. This would crash the Console (bug 936430) when attempting to create a new Exchange Connector or when opening an existing one.
77
"@
88
$dataRow.RuleResult="No such templates found."
99
$dataRow.SAPCategories = "Console"
10-
$dataRow.ProblemSeverity=[ProblemSeverity]::Error
10+
11+
$connectors = ConvertFrom-Csv (GetSanitizedCsv (GetFileContentInSourceFolder SQL_Connectors.csv) )
12+
$exchangeConnectors = $connectors | ? { $_.'Data Provider Name' -eq "Exchange Connector"}
13+
if ($exchangeConnectors.Count -eq 0) {
14+
$dataRow.ProblemSeverity=[ProblemSeverity]::Warning
15+
}
16+
else {
17+
$dataRow.ProblemSeverity=[ProblemSeverity]::Error
18+
}
1119

1220
$linesIn_SQL_ObjectTemplates_WithMissingLocalizations = ConvertFrom-Csv (GetSanitizedCsv ( GetFileContentInSourceFolder SQL_ObjectTemplates_WithMissingLocalizations.csv ) )
1321

@@ -16,8 +24,23 @@ This rule checks if Templates exist that do not have any localized string. This
1624
}
1725
else {
1826
$dataRow.RuleResult = @"
19-
Looks like problematic templates found. Please check in $(CollectorLink SQL_ObjectTemplates_WithMissingLocalizations.csv). $(IgnoreRuleIfText) no Exchange Connector exists. However, it is strongly suggested to add localized string values to these templates to avoid problems in the future.
27+
Looks like problematic templates found. To resolve this issue, please do the following steps:
28+
<br/> 1. Open $(CollectorLink SQL_ObjectTemplates_WithMissingLocalizations.csv).
29+
<br/> 2. Copy the value of the 1st column "Template Name to be edited".
30+
<br/> 3. Open the SM console and navigate to Library/Templates.
31+
<br/> 4. Find/Filter the template (like "Template.59d3859b0aca4bd0aec5f64e3b6059e2") and click Properties.
32+
<br/> 5. Make a modification in the Name or Description fields.
33+
<br/> 6. Uncheck the "When I click OK, open the template form" checkbox at the very end. Don't worry if you forget to uncheck.
34+
<br/> 7. Click the OK button.
35+
<br/> Repeat steps 2-7 for each row in $(CollectorLink SQL_ObjectTemplates_WithMissingLocalizations.csv).
36+
"@
37+
38+
if ($exchangeConnectors.Count -eq 0) {
39+
$dataRow.RuleResult += @"
40+
<br/>
41+
<br/> $(IgnoreRuleIfText) you do not plan to create an Exchange Connector. However, it is strongly recommended to do the steps mentioned above, in order to avoid problems in the future.
2042
"@
43+
}
2144
$Result_Problems += $dataRow
2245
}
2346
}

0 commit comments

Comments
 (0)