You need to sign in to do that
Don't have an account?
Hemant Gulati 4
Getting internal server error issue in lightning app
I am getting this issue "An internal server error has occurred Error ID: 1854847182-41225 (-1177185898)" while inserting a record through lightninig app, as i am calling a Component function from helper file and passing an object(record) in it.
Helper file code:-
createExpense: function(component, expense) {
this.upsertExpense(component, expense, function(a) {
var expenses = component.get("v.expenses");
expenses.push(a.getReturnValue());
component.set("v.expenses", expenses);
this.updateTotal(component);
});
},
upsertExpense : function(component, expense, callback) {
console.log("Save");
var action = component.get("c.saveExpense",expense);
console.log("Save2");
/*action.setParams({
"expense": expense
});*/
if (callback) {
action.setCallback(this, callback);
}
$A.enqueueAction(action);
}
Controller file code:-
public with sharing class ExpenseController {
@AuraEnabled
public static Expense__c saveExpense(Expense__c expense) {
// Perform isUpdateable() check here
System.debug('Upsert Start');
upsert expense;
System.debug('Upsert Done');
return expense;
}
@AuraEnabled
public static List<Expense__c> getExpenses() {
// Perform isAccessible() check here
return [SELECT Id, Name, Amount__c, Client__c, Date__c,
Reimbursed__c, CreatedDate FROM Expense__c];
}
}
getExpenses function is running correctly, but when i am calling saveExpense from helper file, it generates error.
Please help me.
Thanks,
Hemant Gulati
Helper file code:-
createExpense: function(component, expense) {
this.upsertExpense(component, expense, function(a) {
var expenses = component.get("v.expenses");
expenses.push(a.getReturnValue());
component.set("v.expenses", expenses);
this.updateTotal(component);
});
},
upsertExpense : function(component, expense, callback) {
console.log("Save");
var action = component.get("c.saveExpense",expense);
console.log("Save2");
/*action.setParams({
"expense": expense
});*/
if (callback) {
action.setCallback(this, callback);
}
$A.enqueueAction(action);
}
Controller file code:-
public with sharing class ExpenseController {
@AuraEnabled
public static Expense__c saveExpense(Expense__c expense) {
// Perform isUpdateable() check here
System.debug('Upsert Start');
upsert expense;
System.debug('Upsert Done');
return expense;
}
@AuraEnabled
public static List<Expense__c> getExpenses() {
// Perform isAccessible() check here
return [SELECT Id, Name, Amount__c, Client__c, Date__c,
Reimbursed__c, CreatedDate FROM Expense__c];
}
}
getExpenses function is running correctly, but when i am calling saveExpense from helper file, it generates error.
Please help me.
Thanks,
Hemant Gulati