Hi,
I have the following code which works fine online but not offline:
private static async validateWorkOrderIncidents(workorderId: string): Promise<string>
{
const fetchXml = `?fetchXml=<fetch mapping='logical'>
<entity name='msdyn_workorderincident'>
<filter type='and'>
<condition attribute='msdyn_workorder' operator='eq' value='${workorderId}'/>
<filter type='or'>
<condition attribute='new_startdate' operator='null' />
<condition attribute='new_enddate' operator='null' />
</filter>
</filter>
</entity>
</fetch>`;
let serviceRequest;
if (Xrm.Utility.getGlobalContext().client.isOffline())
{
serviceRequest = await Xrm.WebApi.offline.retrieveMultipleRecords(EntityNames.WorkorderIncident, fetchXml);
}
else
{
serviceRequest = await Xrm.WebApi.retrieveMultipleRecords(EntityNames.WorkorderIncident, fetchXml);
}
if (serviceRequest?.entities?.length > 0)
{
return 'Check if work order incident has start and end date!';
}
return 'OK!';
}
Is there anything wrong in my code? Or is it even possible to query date fields offline.
I use this code to do some validation on the field service mobile app and even can't find a way to debug this 😕
Any help is welcome.
If further information is necessary, please let me know.
Thanks Chris