var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='servicetype'>
<attribute name='servicetypename' />
<attribute name='servicetype' />
<attribute name='servicetypeid' />
<attribute name='businessunit' />
<order attribute='servicetype' descending='false' />
<filter type='and'>
<condition attribute='sentinelservicetypename' operator='eq' uitype='sentinelservicetype' value='" + sentinelServiceTypeId + "' />
<condition attribute='statecode' operator='eq' value='0' />
</filter>
<link-entity name='businessunit' from='businessunitid' to='businessunit' alias='bw'>
<attribute name="code" />
<filter type='and'>
<condition attribute='statecode' operator='eq' value='0' />
</filter>
<link-entity name='division' from='divisionid' to='division' alias='bx'>
<filter type='and'>
<condition attribute='statecode' operator='eq' value='0' />
</filter>
<link-entity name='profitcentre' from='division' to='divisionid' alias='by'>
<filter type='and'>
<condition attribute='profitcentreid' operator='eq' uitype='profitcentre' value='" + profitCentreId + "' />
</filter>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>";
console.log(fetchXml);
var layoutXml = "<grid name='resultset' object='2' multiobjectidfield='1' jump='servicetypename' select='1' icon='1' preview='2'>
<row name='servicetype' id='servicetypeid'>
<cell name='servicetype' width='200' />
<cell name='servicetypename' width='150' />
<cell name='businessunit' width='150' />
<cell name='bw.code' width='150' />
<cell name='sentinelservicetypeid' width='150' />
<cell name='sentinelservicetypename' width='150' />
</row>
</grid>";
console.log("View id: " + viewId + "entity name: " + entityName + "View Display Name: " + viewDisplayName + "Layout XML: " + layoutXml);
serviceTypeControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
Getting Below Error::::<Message>Could not find relationship for related entity field bw.code specified in layoutxml.</Message>