I have this component that is available from a Community, where an object gets populated and passed to Apex controller in a JSON String. From the server side, it should show via debug what I ask, but nothing happens.
Component markup:
<aura:attribute name="contactInfo" type="Contact"
default="{
'Id': '',
'MailingStreet': '', 'MailingCity': '',
'MailingState': '', 'MailingPostalCode': '',
'MailingCountry': 'US', 'MobilePhone': '',
'Secondary_Email__c': '',
'Birthdate': '',
--- ETC ---
"/>
Component controller.js:
updateContactInfo : function(component, event, helper) {
var cId = component.get("v.contactId"); // Updated from the doInit method
component.set("v.contactInfo.Id",cId);
// console.log(cId);
var contact = component.get("v.contactInfo");
// console.log('Contact: ' + JSON.stringify(contact));
var action = component.get("c.updateContact");
action.setParams({
jsonContact : JSON.stringify(contact)
});
var self = this;
// console.log('Params ' + JSON.stringify(action.getParams()));
action.setCallback(this, function(response){
var state = response.getState();
if(state === "SUCCESS") {
console.log(response.getReturnValue());
} else {
console.error(JSON.stringify(response.getError()));
}
});
$A.enqueueAction(action);
}
Server-side Apex controller:
@AuraEnabled
public static String updateContact(String jsonContact) {
System.debug(jsonContact);
if (!String.isBlank(jsonContact)) {
try {
Contact con = (Contact) JSON.deserialize(jsonContact, Contact.class);
System.debug('Contact from Client Controller: ' + con);
if (con != null) {
try {
update con;
System.debug(con.Birthdate);
} catch (DmlException e) {
System.debug('Exception' + e.getMessage());
}
}
} catch (Exception e) {
System.debug('Exception' + e.getMessage());
throw new AuraHandledException('There was an error in the Operation: ' + e.getMessage());
}
}
return 'Ok';
}
This is the console log:
And here is where I should see the debug log from the Apex controller but I see nothing.
So, is returning me the 'Ok' String, that means that is accessing the controller method, but what's wrong here? Why I don't see the debugs? Furthermore, why is not executing what is inside the method?
Background:
I'm logged into the community from a Community User with Custom Profile (Apex permission on all classes). The information that I'm trying to edit belongs to that User's contact record (permissions to CRUD on objects) which I have already tested in order to edit a record (does works), so permission should not be the issue I believe (not 100% sure).
I don't know where else to look to troubleshoot this, so thanks in advance for your help.

