This is good Microsoft CRM Hidden tool to check how much
time is taken by form to load.
All Credit goes to Gareth Tucker
This tool opens when you click CTRL +SHIFT +Q
Here are details about how to use Form Load Performance analyzer tool
<?xml version="1.0" ?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="text" indent="no"/> | |
<xsl:template match="/data"> | |
<![CDATA[<p>Dear ]]><xsl:choose> | |
<xsl:when test="account/name"> | |
<xsl:value-of select="account/name" /> | |
</xsl:when> | |
<xsl:otherwise>Valued Customer</xsl:otherwise> | |
</xsl:choose><![CDATA[,</p> <p>We have not heard from you for a while. We wanted to check in and make sure that you are still having a great experience using our product(s). We have asked ]]><xsl:choose> | |
<xsl:when test="account/ownerid/@name"> | |
<xsl:value-of select="account/ownerid/@name" /> | |
</xsl:when> | |
<xsl:otherwise>a customer service representative</xsl:otherwise> | |
</xsl:choose><![CDATA[ to contact you next week to get your feedback on the product(s) you are currently using and to give you details about our upcoming products.</p><p>?]]><xsl:choose> | |
<xsl:when test="account/name"> | |
<xsl:value-of select="account/name" /> | |
</xsl:when> | |
<xsl:otherwise></xsl:otherwise> | |
</xsl:choose><![CDATA[?</p><p> </p> <p>Thank you.</p>]]> | |
</xsl:template> | |
</xsl:stylesheet> |
update Template set Body='<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="text" indent="no"/><xsl:template match="/data"><![CDATA[<p>Dear ]]><xsl:choose><xsl:when test="account/name"><xsl:value-of select="account/name" /></xsl:when><xsl:otherwise>Valued Customer</xsl:otherwise></xsl:choose><![CDATA[,</p> <p>We have not heard from you for a while. We wanted to check in and make sure that you are still having a great experience using our product(s). We have asked ]]><xsl:choose><xsl:when test="account/ownerid/@name"><xsl:value-of select="account/ownerid/@name" /></xsl:when><xsl:otherwise>a customer service representative</xsl:otherwise></xsl:choose><![CDATA[ to contact you next week to get your feedback on the product(s) you are currently using and to give you details about our upcoming products.</p><p>?]]><xsl:choose><xsl:when test="account/accountid"><xsl:value-of select="account/accountid" /></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose><![CDATA[?</p><p> </p> <p>Thank you.</p>]]></xsl:template></xsl:stylesheet>' where Title='Account Reconnect' |
function CheckPrductQuantity(productName) { | |
var fetchXml = ['<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">', | |
'<entity name="quotedetail">', | |
'<attribute name="productid"/>', | |
'<attribute name="productdescription"/>', | |
'<attribute name="priceperunit"/>', | |
'<attribute name="quantity"/>', | |
'<attribute name="extendedamount"/>', | |
'<attribute name="quotedetailid"/>', | |
'<order descending="false" attribute="productid"/>', | |
'<link-entity name="quote" alias="ab" to="quoteid" from="quoteid">', | |
'<filter type="and">', | |
'<condition attribute="quoteid" value="'+ Xrm.Page.data.entity.getId() +'" uitype="quote" operator="eq"/>', | |
'</filter>', | |
'</link-entity>', | |
'</entity>', | |
'</fetch>'].join(''); | |
CrmFetchKit.FetchAll(fetchXml).then(function (quoteProducts) { | |
for (var index in quoteProducts) { | |
var quoteProd = quoteProducts[index]; | |
var quantity = quoteProd.attributes.quantity.value; | |
var product = quoteProd.attributes.productid.name; | |
if (productName == product) { | |
if (quantity < 5) { | |
Xrm.Page.ui.setFormNotification("Quantity should be greater than 5", "ERROR", "productQuantityError"); | |
} | |
else { | |
Xrm.Page.ui.clearFormNotification("productQuantityError"); | |
} | |
} | |
} | |
}, onFetchError); | |
} | |
function onFetchError(xhr, status, errorThrown) { | |
var errormsg = $(xhr.responseXML).find('Message').text(); | |
alert('CrmFetchKit-Error occured: ' + errormsg); | |
} |