function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Lightning Component's Developer Guide Example not working

I am going throught the example and I am at the first part where you should be able to save dating but it doe not save data and it does not give me an error.  I put an alert statement to make sure that the button is actually firing the code.  I have no idea if the object has data in it because all the Alert returns is "[object Object]"  It is not like in the Apex debugger where you can see the content of the object.  It feels like this java script frame work is a step back in time to me.  Not user friend development at all!

Below is part of the example where I put an alert statement that does pop up but like I said it doesn't show any content that the expense object would be holding.

Any ideas -- I have looked at this code over and over and over and over and I see it to be written as I see in the book!
upsertExpense : function(component, expense, callback) {    
        alert("upsertExpense before saveExpense call!");
    	var action = component.get("c.saveExpense"); 
        alert("upsertExpense after saveExpense action! " + expense);
            "expense": expense
        if (callback) {
        	action.setCallback(this, callback);

    },//Delimited for future code

Thanks in advance for your support.
Diana Widjaja MDiana Widjaja M
You might want to try either one of the following lines to display the expense object as a string.
Hope that works for you!
Kevin HuangKevin Huang
exact the same issue here, the callback function is never called.
Diana Widjaja MDiana Widjaja M
When you click the Submit button, you're calling createExpense (formController), which calls helper.createExpense(). The latter then calls upsertExpense and helper.updateTotal(). If you're using the sample code and it's not working, I suspect it could be a namespace typo in updateTotal() (formHelper). Please check that you have total += e.Amount__c if you're using the default namespace, or total += e.myNamespace__Amount__c if you have a registered namespace. You can also try to install the Expense Tracker app via (" target="_blank).