javascriptdynamics-crmworkflowmicrosoft-dynamicscrm

Dynamics CRM 2016 on-premises - Javascript Suddenly stopped working


On Premises Dynamics 2016 v 9.0.51.6 Farm Installation

Code was working prior to 8/19 Suddenly this script stopped working with no prior changes made to my form... customers get an error stating process is not defined.

Upon debugging it seems to break right after the reup status returns true I am at a loss, but it is always helpful to get a second pair of eyes.

What do you guys think?

Debug Error CRM Error

function RenewProgram ()
{
    debugger;
     var reupStatus;
     var processId = "C3B2435A-D08F-4262-9B11-836F47C70866"; // Workflow ID for Reup process
     var accountId;
     var opportunityId;

    responseType = "reup";
    

    accountId = Xrm.Page.data.entity.getId();
        
    try {

      gridRows = Xrm.Page.getControl("Programs").getGrid().getRows();
      gridRows.forEach(function (row, rowIndex) {
    
         opportunityId = row.getData().getEntity().getId();
         currentProgramList.push(opportunityId);
      })
    
     selectedRow = Xrm.Page.getControl("Programs").getGrid().getSelectedRows();
     selectedRow.forEach(function (row, rowIndex) {
            
         attributeColl = row.getData().getEntity().attributes;
         attributeColl.forEach(function (att, attIndex) {
            
             if (att.getName() == "po_distributor"){
                 if (att.getValue() != null && att.getValue() != 'undefined') {
                    renewDistributorID = att.getValue()[0]['id']; //ek
                                        glkPrgmSelectedRowDist = renewDistributorID;

                 }
             }
             if (att.getName() == "po_reupprogram") {
                 if (att.getValue() != null && att.getValue() != 'undefined') {
                     reupStatus = att.getValue();
                 }
                 if (reupStatus == true) {
                     opportunityId = row.getData().getEntity().getId();
                     Process.callWorkflow(processId, opportunityId, successCallback, errorCallback);    
                 }
                
             }
         })
     })

    }
    catch (e) {
        Xrm.Utility.alertDialog(e.message);
    }
}

I tried altering the workflow it is calling by changing the owner and workflow type but that made no change.


Solution

  • From RayGan - you can check the define code of "Process" in line Process.callWorkflow(processId, opportunityId, successCallback, errorCallback);

    @Ray Gan - Thanks, that line was the source of my problem. When i checked my form library "mag_/js./process.js" was not there and this is whats being referenced. Thanks for the tips