I receive OriginationException unable to fetch Application

  • 1
  • Question
  • Updated 11 months ago
  • In Progress
I receive OriginationException unable to fetch application. I have narrowed this down to the Skuid form for the application saves fine using a non-Skuid form. I am very limited in the granularity of processing I can monitor. Please help me understand what is causing this error so that I may take actio to eliminate it. Has anyone encountered this before?
Photo of Ken Becker

Ken Becker

  • 90 Points 75 badge 2x thumb

Posted 11 months ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Ken, can you share more details about your situation?
  • Are you encountering this error message when trying to use Skuid?
  • Can you share the complete error message, and what steps you take that cause it?
  • And, is this affecting all users and all Skuid pages, or just certain users and pages?
  • Has something changed in your environment recently, like an upgrade to your Skuid version, or perhaps the license to Skuid has expired?
(Edited)
Photo of Ken Becker

Ken Becker

  • 90 Points 75 badge 2x thumb
This is an initial implementation. The form has never worked. I tracked the source of this error to a javascript snippet that I will copy below for you. Since I was asked to look into the error I have never seen the form successfully create the object. I can create the object using the standard page so I have ruled out the Salesforce platform. Tracking the source down to the javascript snippet virtually rules that out anyway but I conducted the test of creating the object before tracking the source down to javascript.

var recordTypeId; var recordId;
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
    var sParameterName = sURLVariables[i].split('=');
    if (sParameterName[0] == 'RecordType') {
         recordTypeId = sParameterName[1];
    } else if (sParameterName[0] == 'retURL') {
    var qr = sforce.connection.query("SELECT Id,Name FROM RecordType WHERE DeveloperName IN ('Lease','Loan','Line_Of_Credit','Package') AND isActive = true AND SobjectType ='"+"genesis__Applications__c"+"'  order by Name");
    var records = qr.getArray("records");
    recordId = records[1].Id.slice(0,15);
    recordTypeId = recordId;   
    }
       
}

var applicationModel = skuid.model.getModel('Application');
var appRow = applicationModel.data[0];
var contactModel = skuid.model.getModel('Contact');

var actionModel = skuid.model.getModel('Temp');
var tempRow = actionModel.data[0];

var accountModel = skuid.model.getModel('Account');
var accRow = accountModel.data[0];

var productModel = skuid.model.getModel('Product');
var productRow = productModel.data[0];

var businessModel = skuid.model.getModel('BusinessInfo');
var businessRow = businessModel.data[0];
var businessId;

if(productRow.clcommon__Class__c.toLowerCase() === 'consumer') {
    if(tempRow.genesis__New_Borrower__c) {
        skuid.model.save([contactModel], {callback: function(result){
            if (result.totalsuccess) {
                console.log('Success');
                appRow.genesis__Contact__c = contactModel.getFirstRow().Id;
                doProcess();
            } else {
              // There was a problem. Let's see what went wrong.
              alert('Error: ' + result.insertResults[0]);
              console.log(result.insertResults[0]);
            }
        }});
    } else {
        doProcess();
    }
}else if(productRow.clcommon__Class__c.toLowerCase() === 'commercial') {
    if(tempRow.genesis__New_Borrower__c) {
        skuid.model.save([accountModel, contactModel, businessModel], {callback: function(result){
            if (result.totalsuccess){
                appRow.genesis__Account__c = accountModel.getFirstRow().Id;
                appRow.genesis__Contact__c = contactModel.getFirstRow().Id;
                businessId = businessModel.getFirstRow().Id;
                doProcess();
               
            } else {
              // There was a problem. Let's see what went wrong.
              alert('Error: ' + result.insertResults[0]);
              console.log(result.insertResults[0]);
            }
        }});
    } else {
        doProcess();
    }
}

function doProcess() {
    for(var key in appRow) {
        //alert(key.search(/__c/i));
        if(key.indexOf("__c", key.length - 3) === -1) {
           //alert('key : ' + key);
           delete appRow[key];
        }   
   
    }
    for(var key in tempRow) {
        if(key.indexOf("__c", key.length - 3) === -1) {
           delete tempRow[key];
        }
    }

    var result;
    var param = new Object();
    param.recordTypeId = recordTypeId;
  
    param.applicationStr = JSON.stringify(appRow);
    param.tempStr = JSON.stringify(tempRow);
    if(businessId !== undefined) {
        param.businessId = businessId;
    }
    alert('Record Type = '+param.recordTypeId);
    alert('businessId = '+businessId);
    try {
        alert('CkPoint #2');
        result = sforce.apex.execute('genesis.SkuidNewApplication','createApplication', param);
        alert('result is : '+result);
        window.location = '/' + result;
     
    } catch (err) {
        var message = err;
        if(err.faultString !== undefined) {
            message = err.faultString.split("\n")[0];
        }
        alert(message);  /*************This is where the error is caught and pop up is presented. *******/
        //skuid.$.unblockUI();
        return;
    }
   
}


The error message reads:
Photo of Ken Becker

Ken Becker

  • 90 Points 75 badge 2x thumb
Oh, you will probably notice a few of my own alerts I added to help me debug the script.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Ken, while I'm not able to debug the code in depth, the fact that this action is failing

sforce.apex.execute('genesis.SkuidNewApplication','createApplication', param);

may indicate that the Apex action isn't invokable, or there's something going wrong after the genesis.SkuidNewApplication code is triggered. 

Here's documentation on Invokable Methods that may help clarify what I'm wondering about.

And, there's a whole topic of documentation about Apex that may be helpful as you try to troubleshoot this code. If you are able to contact the party who created this snippet, they may also have more information about why this handoff to Salesforce seems to be failing. 
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Ken,

It looks like you are trying to access data from a managed application.  You should check that you have access to the application (objects/fields) and a license.  I also recommend that you turn on debug log for whatever user account you are testing with to see if there is more information on the error.

Thanks,

Bill