I created the template to automatically add the role to Business partner on record creation.
<xsl:template match="/">
<xsl:apply-templates select=“ROOT”/>
</xsl:template>
<xsl:template match="ROOT">
<BusinessPartner>
<Id><xsl:value-of select = "AS:GenerateId()"/></Id>
<BusinessPartnerRole
Id="{AS:GenerateId()}"
refBusinessPartnerRoleTypeId="{AS:GetConstant('BusinessPartnerRoleType_Producer')}"
/>
</BusinessPartner>
</xsl:template>
The screen works preetty well until I add the default template on it.
After that I get the “Object reference not set to an instance of an object” error message.
Because the screen does work by this way too,
I suspect it can be caused by the combination of lazy loaded screen with the default template.