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
Soundar Rajan PonpandiSoundar Rajan Ponpandi 

Call back value is Error in Controller

Hi ,

below code getting Error State while saving the record so i couldn't navigate to recently created record page.
 
getSave : function (component, event, helper) {
        alert('Current Record Id |' + component.get("v.recordId"));
        var action = component.get("c.GD_newQuoteVersion");
        var toastEvent = $A.get("e.force:showToast");
        action.setParams({
            //"quote":component.get("v.quote"),
            quoteId: component.get("v.recordId")
        });
        
        action.setCallback(this,function(result){
            var state = result.getState();
            alert('state ' + state);
            /*if (state == "SUCCESS") {
                var res = result.getReturnValue();
                alert('INside of success ' + res);
                component.set("v.returnId",res);
            }*/
            var newQtId = result.getReturnValue();
            console.log('Return Value is:' + JSON.stringify(result.getReturnValue()));
            alert('New Quote Id - ' + JSON.stringify(result.getReturnValue()));
            //component.set("v.returnId",data.getReturnValue());
            /*Toast Event*/
            toastEvent.setParams({
                title: "Success!",
                message: "Quote is created successfully!",
                type: "success"
            });
            toastEvent.fire();
            /*Navigation*/
            var recId = component.get("v.recordId");
            var sObectEvent = $A.get("e.force:navigateToSObject");
            sObectEvent .setParams({
                "recordId": recId,
                "slideDevName": "detail"
            });
            sObectEvent.fire();
        });
        $A.enqueueAction(action);  
    }

Can anyone please tell me where i did mistake ? 

Hearty thanks in advance.

Regards,
Soundar.
Best Answer chosen by Soundar Rajan Ponpandi
Santosh Kumar 348Santosh Kumar 348
Check out your code in APEX as STATE  value is returned from APEX class.
Check the debug log, there must be some exception occuring at the time of saving the record.

The simple way to check the debug log is in Developer console, just check out log section in DevConsole when you have excuted your code else you  can setup Debug log for your name and can check.

Mark this answer as closed if it served your purpose.

Regards,
Santosh Kumar