Verifying the section records and updating the "profile completion"

Question

The profile completion in accounts displays incorrectly (thousands instead of %). As a solution, we were recommended resaving each record (which indeed helps), but we have more than 5000 accounts – resaving is not a good option for us.

Answer

The record is updated upon opening the page as a result of calling the GetRecordCompleteness() method of the CompletenessService service.

You can get all records for the further processing from the browser console. For this, execute:

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName: "Account"});
esq.addColumn("Id");
esq.getEntityCollection(function(result) {
   var items = null;
   if (result.success) {
      items = result.collection;
      document.testResult = items;
      console.log("testResult added");
   }
}, this);

After this, call the service method for every record (it will take some time).

document.iter = 0;
document.myLoop = function() {
    var item = document.testResult.collection.items[document.iter];
    setTimeout(function () {  
      // ---------
      console.log(item.values.Id);
      var config = {
       recordId: item.values.Id,
       schemaName: "Account"
      };
      require(["ServiceHelper"], function(ServiceHelper) {
       ServiceHelper.callService("CompletenessService",
        "GetRecordCompleteness",
         function(response) {
         },
         config,
       this);
      });
      // ---------  
      document.iter++;                  
      if (document.iter < document.testResult.collection.items.length) {         
         document.myLoop();            
      }                       
   }, 1000)
};
document.myLoop();

 

Like 0

Like

Share

0 comments
Show all comments