• Dr. Who
  • NEWBIE
  • 10 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I referenced the documentation on writing debug messages to console.  Docs had this pattern for logging:
({
	actionFunction : function(component, event, helper) {
           $A.logger.subscribe("INFO", logCustom);
           $A.log("some message about function");

    	   //  code to perform action function here

           //helper methods 
           function logCustom(level, message, error) {
              console.log(getTimestamp(), "logCustom: ", arguments); 
    	   }
    	
           function getTimestamp() {
              return new Date().toJSON();
    	   }        
	}
})
This is fine.  But, I've got several functions in my controller and I don't want to cut and paste logCustom() and getTimeStamp() into every controller action.  Nor, do I want to have to initialize the logger by calling $A.logger.subscribe(...) in every method call.  This seems like something for Helper.  My initial attempt was to move logCustom() and getTimeStamp() from the Controller function to Helper and then just call
$A.logger.subscribe("INFO", helper.logCustom);

within the body of the controller action.  After doing this my component stopped working.  No log message in the Chrome developer console.  No log in the Force.com Developer Console to indicate an error.

Two questions:
What did I miss here regarding the appropriate use the the Helper within the framework?
Where else should I look for error messages to see why controller code is not executing?

Thanks
 
This client-side DisplayCaseController does not pass the challenge with error "The client side controller does not refer to the 'getCaseFromId' method of the Apex controller class".  Component and controller are pasted below.  The component runs from a test lighnting app.  getCaseFromId is correctly referenced as "var action = component.get("c.getCaseFromId");" in the first line of code


component
<aura:component controller="DisplayCaseController" >
    <aura:attribute name="record" type="Case"/>
	<ui:inputText aura:id="caseId" label="Enter Case Id: "/>
    <ui:button label="Get Case" press="{!c.getCaseRecord}"/><br/>

    Subject: <ui:outputText value="{!v.record.Subject}"/><br/>
    Description: <ui:outputText value="{!v.record.Description}"/><br/>
    Status: <ui:outputText value="{!v.record.Status}" /><br/>
</aura:component>
client-side controller
({
	getCaseRecord : function(component) {
        var action = component.get("c.getCaseFromId");
        var caseId = component.find("caseId").get("v.value");
        action.setParams({ "caseID" : caseId });
        action.setCallback(this, function(action) {
			if (action.getState() === "SUCCESS") {
 				component.set("v.record", action.getReturnValue());
            }
            else {
                alert("Action state: " + action.getState());
            }
        });
        $A.enqueueAction(action);
	}
})
Test Application
<aura:application>
    <c:DisplayCase/>
</aura:application>


 

Hi Guys,

I am relatively new in Apex trigger. I have a custom object named Lead source with lead name, domain name and lead reference (lookup) field. These fields also exist in Lead Object. Now My trigger on lead should do the following:

 

1. Check if a record already exist in Lead source. if it does update the reference field on Lead with Lead source reference.

2. If it does not exist create a new record in lead source also update the Lead reference with the id of record to be saved while saving.

 

Any help will be appreciated....

what is SOAP AND REST?  its difference

I got production, fullcopy sandbox.

 

I created users in production and created full copy sandbox and then created territory hiererchy in Production..

 

Now when i see in production I can see User,territory in production and only users in Fullcopy sandbox.

 

 

Now  need to create account fields,custom object,account data..where should I do..?

I am confused what to do with territory that i created in production.

I need to get in Full copy..If not possible , what is the best practices from nowonwards...