Skip to main content

Posts

Showing posts with the label fetchxml

FetchXML query order by

 If we want to get the latest created record from an entity we can get it using the FetchXML query order. <fetch top="50"> <entity name="systemuser"> <order attribute="createdon" descending="true" /> </entity> </fetch>

D365 get fetchxml alias value

 If we use an alias in our fetchxml query it will not retrieve the alias attribute like the default query. String inputstdssAttendeeFetchXML = $@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='std_stdssattendee' > <attribute name='std_attendeeroleid' /> <filter> <condition attribute='std_stdstdssid' operator='eq' value='{ inputstdss.GetAttributeValue<Guid>("std_stdstdssid")}' /> <condition attribute='statecode' operator='eq' value='0' /> <condition attribute='std_attendeeroleid' operator='not-null' /> ...

D365 FetchXML query into plugin

 Generate the xml query using xrmtoolbox and try with this code sample. String eventsessionFetchXML = $@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='baseevt_eventsession' > <attribute name='baseevt_eventid' /> <attribute name='baseevt_sessionenddatetime' /> <attribute name='baseevt_sessionstartdatetime' /> <attribute name='baseevt_name' /> <attribute name='baseevt_description' /> <filter> <condition attribute='baseevt_eventid' operator='eq' value='{inputEntity.Id.ToString()}' /> </filter> </entity> </fetch>"; var eventSessionresult =...

D365 Calculate unitwise product quantity into Opportunity field using javascript

  function CalculateOpportunityProductQuantity(executionContext) { var formContext = executionContext.getFormContext(); var opportunityRecordId = formContext.data.entity.getId().slice(1, -1); var globalContext = Xrm.Utility.getGlobalContext(); // Retrive unitwise product quantity data var fetchXml = "<fetch mapping='logical' >" + "<entity name= 'opportunity' >"+ "<link-entity name='opportunityproduct' from='opportunityid' to='opportunityid' alias='opportunityprod' >"+ "<attribute name='quantity' />"+ "<filter>"+ "<condition attribute='opportunityid' operator= 'eq' value='" + opportunityRecordId + "' uiname='Will be ordering' uitype='opportunity' />"+ "</filter...