thuld / crmfetchkit Goto Github PK
View Code? Open in Web Editor NEWLibrary for Dynamics CRM that allows the execution of fetchxml-queries via JavaScript
License: MIT License
Library for Dynamics CRM that allows the execution of fetchxml-queries via JavaScript
License: MIT License
Hi (great library by the way)
Can you expose the SoapParser externally to enable a caller to easily use the paging cookie. Its used internally in fetchall.
If not then could you add an example to the site showing how a user can use the paging functionality.
Attached is a trivialised (badly coded example); showing CRMFetchKit loading 2 pages of data, by utilising the SoapParser setPagingDetails() method which I made public.
Is there a better way to update the fetchxml and call with the paging cookie and page no.??
var fxml2 = [
'<fetch count="5" returntotalrecordcount= "true" >',
'<entity name="customeraddress" >',
'<attribute name="line1" />',
'<attribute name="city" />',
'<attribute name="stateorprovince" />',
'<attribute name="county" />',
'<attribute name="country" />',
'<attribute name="postalcode" />',
'<order attribute="city" descending= "true" />',
'</entity>',
'</fetch>'
].join('');
CrmFetchKit.FetchMore(fxml2).then(function (response) {
console.log(response.totalRecordCount);
console.log(response.moreRecords);
console.log(response.entityName);
console.log(response.pagingCookie);
for (var i = 0; i < response.entities.length; i++) {
console.log(response.entities[i].getValue('line1'));
}
var sp = CrmFetchKit.GetSoapParser();
fxml2 = sp.setPagingDetails(fxml2, 2, response.pagingCookie);
CrmFetchKit.FetchMore(fxml2).then(function (response) {
console.log(response.totalRecordCount);
console.log(response.moreRecords);
console.log(response.entityName);
console.log(response.pagingCookies);
for (var i = 0; i < response.entities.length; i++) {
console.log(response.entities[i].getValue('line1'));
}
var sp = CrmFetchKit.GetSoapParser();
fxml2 = sp.setPagingDetails(fxml2, 2, response.pagingCookie);
});
});
Hello
how to make result with admin to list result to member (normal) view ? is possible? privilege
Look a error:
http://prntscr.com/9aauaz
Thanks
Live:sandro.alvares
In IE i get the Above error While in chrome i do not and it works fine
here is the code
annid = currenturl.substr(currenturl.lastIndexOf('/') + 1);
annid = annid.replace("med_announcement_view?data=","");
console.log(annid);
var serverUrl = Xrm.Page.context.getClientUrl();
annUrl = serverUrl + "/WebResources/med_announcement_view?data=";
//Announcement
var fetchxml = [
'',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
''
].join('');
CrmFetchKit.Fetch(fetchxml).then(function(entities) {
document.getElementById("currenttitle").innerHTML = entities[0]["attributes"]["med_name"]["value"];
});```
this is a webresource page thats **not** part of a bigger form, its a pop out page,
hence i include the below in the header so i can use the XRM object
`<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>`
WebAPI was released in CRM 8.0 (CRM 2016). Can CrmFetchKit be made to use this instead of the SOAP endpoint if it is available?
There's a few JavaScript warnings appearing when using CRM 2015 Update 1. I've fixed these in our branch with the following. Is this patch OK?
@@ -5602,10 +5602,13 @@
// since version SDK 5.0.13
url = context.getClientUrl();
}
- else if ( context.isOutlookClient() && !context.isOutlookOnline() ) {
+ else if ( context.isOutlookClient !== undefined && context.isOutlookOnline !== undefined &&
+ context.isOutlookClient() && !context.isOutlookOnline() ) {
+ // isOutlookClient() and isOutlookOnline() have been depreciated in CRM 2015 Update 1
url = localServerUrl;
}
- else {
+ else if ( context.getServerUrl !== undefined ) {
+ // getServerUrl() is only available pre CRM 2015 Update 1
url = context.getServerUrl();
url = url.replace(/^(http|https):\/\/([_a-zA-Z0-9\-\.]+)(:([0-9]{1,5}))?/, localServerUrl );
url = url.replace(/\/$/, "" );
Hi,
Thanks for the great library. Is it possible to cancel a fetch?
Say there's a custom search form that fires off a few fetches upon pressing the "find" button. If the find button is pressed quickly multiple times can any previous incomplete fetches that are still running be cancelled, just leaving the last search criteria running. Is this doable?
Since you are packaging the BlueBird Promise library within CrmFetchKit, I was wondering if there was a way to get the promise object from the CrmFetchKit. I am trying to use the Promise.All() capability, and don’t want load another library since the CrmFetchKit has it.
If not, any plans to expose it, or provide the Promise.All() capability within the CrmFetchKit library, like:
CrmFetchKit.all([CrmFetchKit.Fetch(xml1), CrmFetchKit.Fetch(xml2)]).then(function () {
console.log("all in");
});
Just thought I'd let you know that version 3.3.0 actually has version 3.2.0 at the top of the scripts:
-// CrmFetchKit.js 3.1.0
+// crmfetchkit.js 3.2.0
// https://github.com/thuld/CrmFetchKit
When attempting to retrieve an Appointment entity from CRM using GetById (or GetByIdSync), the request fails with the message: "'Appointment' entity doesn't contain attribute with Name = 'appointmentid'."
Digging into the code, it would appear that the issue is caused by the following line in the function buildGetByIdFetchXml
of soapXmlMessages.js
var idAttribute = entityname + 'id';
Unfortunately, the id field on the appointment entity is actually activityid
. I suspect this will also fail for other activity entity types as well.
I included the library (CrmFetchKit.Bundle.js) in my CRM instance as a web resource. When I go to execute a query, I get the error "unable to get property replace of undefined or null reference" in line 5339. This line seems to be giving me problems starting at 5340:
var escape = module.exports = function escape(string) {
return string.replace(/([&"<>'])/g, function(str, item) {
return escape.map[item];
})
Why isn't string defined?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.