JayData, Dynamics Crm, External auth
by JayData
HTML
<script src="http://include.jaydata.org/datajs-1.0.3.js"></script>
<script src="http://include.jaydata.org/1.3.1crm/jsrender.js"></script>
<script src="http://include.jaydata.org/1.3.1beta/jaydata.js"></script>
<script src="http://include.jaydata.org/1.3.1beta/jaydatamodules/jaydata.mscrm.js"></script>
<script src="http://include.jaydata.org/1.3.1crm/crmcontext.js"></script>
<div id="login">Login:
<h4>[email protected] </h4>
Pass:
<h4>QWEasd123</h4>
<button class="login">Login</button>
</div>
<ul id="results"></ul>
<script type="text/x-jsrender" id="leadListItem">
<li>{{>FullName}}</li>
</script>
JavaScript
function loginAndList() {
var config = {
url: "https://jaydata.crm.dynamics.com",
typeFilter: {
'Microsoft.Crm.Sdk.Data.Services.Annotation': true,
'Microsoft.Crm.Sdk.Data.Services.Lead': ['FullName', 'Lead_Annotation'],
'Microsoft.Crm.Sdk.Data.Services.new_test': true
},
dependentRelationsOnly: true
}
$data.MsCrm.Auth.messageHandlerPath = "/WebResources/new_postmessage2.html";
$data.MsCrm.init(config, /*$org.CrmContext,*/ function (dataContext, factory) {
$('#login').html('Logged in. Listing Leads, please wait');
dataContext.LeadSet.toArray(function (leads) {
$('#results').html($('#leadListItem').render(leads));
});
});
}
$('.login').on('click', loginAndList);