Monday, February 4, 2019

Dynamics CRM Field Service Journey 1 – Change Field Service Mobile Filters

Dynamic CRM field service has rich mobile component which helps users who need mobility like maintenance service employees. They can install Dynamic CRM Field Service mobile app on their mobile and perform most of the field service related tasks using mobile device such as complete work orders, get customer signatures, create follow-up tasks/work orders etc. Field service mobile app facilitate users to use it in both online and offline. After user add relevant credentials and sync with Dynamic CRM it load relevant data in to the mobile local storage. Then users can perform their actions in offline mode as well. That helps users who travel and working on-site.


Field service mobile app completely based on the Resco Mobile CRM and they use woodford project to store mobile customizations. For more details about woodford projects and Resco Mobile CRM visit following reference (Resco Mobile CRM: https://www.resco.net/mobilecrm/ , Woodford: https://www.resco.net/support/guides/woodford/)


Standard Field Service mobile app is pre-customized woodford project which runs on Resco Mobile CRM platform. Standard Field Service mobile app used lots of filters to reduce the data which synced from CRM to mobile device. Sometime it may not show relevant work orders due to those filters. In such cases we have to change sync filters in woodford project. According to the latest Field Service woodford project it use following conditions filter work orders.



  1. Status = Active
  2. Word order status = Open-Unscheduled,  Open-Completed, Open-In Progress, Open-Scheduled
  3. Bookable resource booking should be in Active status
  4. Resource of the bookable resource booking should be current user (who logged in to the Field Service Mobile App)
  5. Booking status = In Progress, On Break, Scheduled, Traveling
  6. Start time should be on Today or within next 7 days
  7. End time should be on Today or within next 7 days



Example: Users need to sync work orders based on sub status and sync work orders today or within current month (30 days). Then we have to modify the sync filters to achieve that requirement.

How to modify the sync filters


Step 1: Open woodford project using woodford. Resco introduce new html 5 based woodford editor and they keep their old siverlight based woodford editor as well. You can navigate to the woodford in following way.


 Navigate to the CRM Settings and navigate to the Mobile CRM section then woodford










I used legacy woodford editor in rest of the configurations users can use one of these editors for project editing.





Step 2: Navigate to work order entity and open Sync Filter








Step 3: Using Add condition you can add the condition (Tip: before you click on add condition select existing condition then it will place to the correct place). You can perform delete unwanted conditions, group conditions, change existing conditions and may more actions. After you complete the changes you have to save the filter














Step 4: Publish the project. You have to instruct the users re sync again after you did the modifications to the project otherwise it will not affect (if there are any sync errors you have to delete data and sync again)


Tip: If you have any other filtering issues you can follow same steps to change those filters as well


Sunday, January 13, 2019

Resco Mobile CRM Tricks – Implement pagination in Resco Mobile CRM query - Javascript

Due to the server performance constrains Resco Mobile CRM returns 500 records only when we executing the query. There is no available setting to break that limitations. However to retrieve all the records we need then we have to implement the pagination for the query execution. Resco queries are execute in asynchronous way. We have to make sure we retrieve all the records before we proceed further.
We can follow followings steps to retrieve all records using pagination.

  
     1. Retrieve count of all the records we have to retrieve and set that value in global variable
In my case I have to retrieve all the answers belongs to the set of questions. I create fetch xml and retrieve answers count then determine how many pages need to be retrieved. After calculate the pages then built query need to retrieve data from the answers entity.


var NumberOfAnswerPages = 0;
var DataPagingSize = 500;
var ResultAnswers = [];

function GetAllAnswersCountByQuestions() {
 NumberOfAnswerPages = 0;
 Result_Ans = [];
 var FetchXml_Ans = "<fetch resultformat='DynamicEntities' version='1.0' output-format='xml-platform' mapping='logical' no-lock='true' aggregate='true' returntotalrecordcount='true' >" +
  "<entity name='new_answers'>" +
  "<attribute name='new_answersid' alias='recordcount' aggregate='count'  />" +
  "<filter type='and'>" +
  "<condition attribute='new_questionsid' operator='in'>";
  for (var qIndex = 0; qIndex < QuestionsArray.length; qIndex++) {
   FetchXml_Ans = FetchXml_Ans + "<value  uitype='new_questions'>" + QuestionsArray[qIndex].id + "</value>";
  }
 FetchXml_Ans = FetchXml_Ans + "</condition></filter></entity></fetch>";

 MobileCRM.FetchXml.Fetch.executeFromXML(FetchXml_Ans,
  function (data) {                    

   if (data != null && data != undefined && data.length > 0) {                        
    var recordsCount = data[0].properties["recordcount"];

    if (recordsCount > 0) {
     NumberOfAnswerPages = recordsCount / DataPagingSize;
     var questionIds = [];
     for (var qIndex = 0; qIndex < QuestionsArray.length; qIndex++) {
      questionIds.push(QuestionsArray[qIndex].id);
     }

     var answers = new MobileCRM.FetchXml.Entity('new_answers');
     answers.addAttribute('new_answersid');
     answers.addAttribute('new_name');
     answers.addAttribute('createdon');
     answers.addAttribute('new_questionsid');
     answers.addAttribute('new_answercrmvalue');
     answers.orderBy("new_order", true);

     var filter = new MobileCRM.FetchXml.Filter();
     filter.isIn("new_questionsid", questionIds);
     answers.filter = filter;

     var fetch = new MobileCRM.FetchXml.Fetch(answers);
     fetch.count = DataPagingSize;
     fetch.page = 1;

     ExecuteAnswerPaggingFetch(fetch, 1);

    } else {
     Result_Ans = [];
     //Do The Rest
    }

   } else {
    Result_Ans = [];
    //Do The Rest
   }
  },
  function (error) {
   MobileCRM.bridge.alert("Answer Records Retrieving Error : " + error);
   removePanels();
  }, null);
}


      2. Recursively call the data retrieval method and execute other methods after complete the data extraction. This will help to synchronize method flow even Resco execute data retrieval asynchronously. 

function ExecuteAnswerPaggingFetch(fetch, page, success) {
 fetch.page = page;
 fetch.execute("DynamicEntities", function (res) {
  if (res != null && typeof res != 'undefined' && res.length > 0) {
   for (var i = 0; i < res.length; i++) {
    ResultAnswers.push(res[i]);
   }
  }

  if (page > NumberOfAnswerPages) {
   //Now data retrieval is completed call next set of methods
   return;
  }

  ExecuteAnswerPaggingFetch(fetch, page += 1);
 }, MobileCRM.bridge.alert, null);
}

Monday, December 17, 2018

Web App not showing correctly in Dynamic CRM which has different language as default language

We face issue one of our client complaining about components of site map are missing and it shows entity names incorrect way. Once we analysed the issue they use dynamic crm instance with Danish language as default language. We create additional titles in the web app and using Danish and it resolved the problem.


 App Site Map without additional titles



Adding additional title to site map

Go To Model Driven App => Open App => Go to Site Map, then add additional title with correct language




Thursday, February 9, 2017

C# WCF Tips: Fix error “object reference is not set to an instance object” while adding WCF service reference

When we adding service reference to project sometimes we encounter “object reference is not set to an instance object” error. Sometimes it fix after follow following steps.


Step 1: Check are there any errors in WCF service and if there were errors fix it and retry.

Step 2: If there were existing service reference then delete it and add again. 

Step 3: If step 2 not success then delete reference from service reference folder in project location (from hard disc) and try to add reference again.

Step 4: If first three steps not working go to the app config or web config file and remove relevant endpoint settings and try to add again.

Step 5: Host WCF service in iis and add service reference from iis url