• Ravi Sankar 12
  • NEWBIE
  • 40 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies
I appreciate if anyone can give me a solution for this. I have a button on a lightning page. Onclick it makes a call to external system and shows the response in a model. I want to show an error message if the response delays by 30 sec to the agent and refresh the page. Can I use something like below? If yes please help me if there are any mistakes in using this. Also, I want the time out to be fired only if the response delays by 30 sec. If the agent gets the response in 30 sec, timeout error shouldnt be fired.
I appreciate your help.
onclick="{!c.callServerMethod;setTimeout('alert('time exceeded 30 sec.!')', 30000)}"

 
Hello All,

I am trying to call other component using aura:method, but getting some errors. I appreciate if you can help.
Apex Controller


public class TestingIntegrationErrorHandling {
    @AuraEnabled
    public static object sampleCallout(){
        system.debug('entered apex');
       
        return object;
    }
}

The controller is working perfect
 
Parent Component:

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="CDI_TestingIntegrationErrorHandling" >
	<aura:attribute name="messageLog" type="Object__C" />
    <c:CDI_TestComponentParent aura:id="child"/>
    <lightning:button label="CallErrorHandlingComp" onclick="{! c.callChildMethod }" />
</aura:component>

Controller:
callChildMethod : function(component, event, helper) {
       console.log('calling child method');
       
        var action = component.get("c.sampleCallout"); 
        action.setCallback(this, function(result){
            var messageLog = result.getReturnValue();
            console.log('---messageLog-- ' + messageLog);
            component.set("v.messageLog", messageLog);
            
        });
        var childCmp = component.find("MessagePanel");
        var retnMsg = childCmp.executeMyMethod(messageLog);
        consolo.log('executing child');
        
        $A.enqueueAction(action);      
        
	}
 
Child component:
<aura:component access="global">	
    <aura:method name="executeMyMethod" action="{!c.executeMyMethod}">
         <aura:attribute name="messageLog" type="MessageLog__c" />
    </aura:method>	
</aura:component>

Controller:
executeMyMethod : function (component, event, helper) {
        var params = event.getParam('arguments');
        if (params) {
            var param1 = params.MessageLog__c;
			console.log('param1  ' + param1);
            component.set('v.messageLog',params.MessageLog__c);
            
        }
    }

Thank you for your help
I have component 1 and a button1 on it. A component2 pops up when I click on Button1. on Component2 I have a button2 which opens flows. when I click on button2 I want to close component1 in the backend.

I appreciate your help. Thank you
Hello All,

I have Picklist Field A with 16 values and picklist field B with 2 values(Mail/Email). Few values in Picklist A should have both email and mail so that user can select one. Few should have only one either mail/Email.  This is in lightning.

Please let me know the ways to do it.

Thank you for your help.
 
I'm trying to call a flow on click of a button in lightning component. It looks like nothing is happening. Im getting the below error.
Uncaught Error in $A.getCallback() [[object Object]]
Callback failed
I appreciate your help.
callIcleFlow : function (component) {       
                var flow = component.find("flowData");
                //Put input variable values
                var inputVariables = [
                      {
                        Connection_Mode : component.get("v.communicationChannel"),                       
                        Contact_Name : component.get("v.contactName")                        
                    } 
                   /* {
                        name : "Connection_Mode",
                        type : "String",
                        value : component.get("v.communicationChannel")
                    },
                    {
                        name : "recordId",
                        type : "String",
                        value : component.get("v.recordId")
                    } */

                ]; 
                //Reference flow's Unique Name
                console.log('input flow parameters ' + inputVariables); 
                flow.startFlow("CDI_ICLE_NCHG",inputVariables);                
         
    }
 
<lightning:button type ="submit" variant="brand" label="Next1" onclick="{!c.callIcleFlows}"/>
     <lightning:flow aura:id="flowData"/>

 
I have a scenario where I need to create records in a custom object whenever an exceptioin occurs(Dml,email,async or any other types of exceptions). I have written a gerneric apex class to create records. Whenever exception occurs, in the catch block I am calling a method to create a excetion record.
Below is my code. I am thinking of a workaround to bulkify the below code.
public static void testDMLUpdate(Test_CDI__c[] newData){
        for(Test_CDI__c T: newData){
            
            if(T.Debug_Field__c == null){
                Test_CDI_2__c test = new Test_CDI_2__c();
                test.Name = 'Debug filed is null';
                try{
                	insert test;
                    system.debug('inserting the record no exctption fired');
                }
                catch(exception e){
                    CDI_MessageLogger.logException(e, T.Id);
                }
            }
        }
    }

I know writing a dml operation in the for loop is bad. but I need to capture the Id of the record causing the exception.  CDI_MessageLogger.logException(e, T.Id); is the method creating record in the custom object for each exception.

Thanks in advance.
User has edit access on the Territory2 standard field on opportunity. But the change link is not appearing to change the value. Admins can do it but other users do not see the change link to change the territory on opportunity.
I am trying to increase the width of lightning quick action. Tried many ways by reviewing different blogs. But no luck. Please help.
 
<aura:component controller="MassUpdate" implements="flexipage:availableForRecordHome,flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global" >
	<aura:attribute name="data" type="customObject__c[]"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="draftValues" type="Object" default="[]"/>
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.Doit}"/> 
    <ltng:require styles="{!$Resource.Model_Width_Expand + '/main.css'}"/> 
    <div  >
      
        <lightning:datatable
            columns="{!v.columns }"
            data="{!v.data }"
            keyField="Id"    
            onsave="{!c.handleSaveEdition}"                 
        />
    </div> 
   
</aura:component>

 
I am trying to mass update child records with a lightning quck action on the parent record detail page. Not sure what is wrong with this code. I appreciate your help.
Component 

<aura:component controller="MassUpdateController " implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
	<aura:attribute name="data" type="object__c[]"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="recordId" type="String"/>
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.init }"/>        
    <div style="height: 300px">
        <lightning:datatable
            columns="{! v.columns }"
            data="{! v.data }"
            keyField="id"                 
        />
    </div>
</aura:component>


Controller:

({
	
		init: function(cmp,event, helper) {
        cmp.set('v.columns', [
            {label: 'Name', fieldName: 'Name', type: 'text'  }            
          //  {label: 'Provider Email', fieldName: 'ProviderEmail', type: 'email', editable: true },
          //  {label: 'Not Associated to this Location', fieldName: 'NotAssociatedToThisLocation', type: 'checkbox' }
            
        ]);
        helper.fetchData(cmp,event, helper);        
	}
})


Helper

({
    fetchData: function (cmp,event,helper) {
        var RecordId = component.get("v.recordId");
        action.setParams({
        	"recordId" : RecordId
    	});
        var action = cmp.get("c.getRecords");
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var data = response.getReturnValue();
                cmp.set('v.data',data);
            }
            // error handling when state is "INCOMPLETE" or "ERROR"
        });
        $A.enqueueAction(action);
    }
})

Apex Controller

public class MassUpdateController {
	@AuraEnabled
    public static list<Managed_Care_Provider__c> getRecords(Id recordId){
        system.debug(' record Id ' + recordId);
        list<object__c> lstMC = [SELECT Id,Name from Object__c where Opportunity__c=: recordId];
        system.debug('---- list of MC ' + lstMC);
        return lstMC;
    }
}
Hello All,

I am trying to call other component using aura:method, but getting some errors. I appreciate if you can help.
Apex Controller


public class TestingIntegrationErrorHandling {
    @AuraEnabled
    public static object sampleCallout(){
        system.debug('entered apex');
       
        return object;
    }
}

The controller is working perfect
 
Parent Component:

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="CDI_TestingIntegrationErrorHandling" >
	<aura:attribute name="messageLog" type="Object__C" />
    <c:CDI_TestComponentParent aura:id="child"/>
    <lightning:button label="CallErrorHandlingComp" onclick="{! c.callChildMethod }" />
</aura:component>

Controller:
callChildMethod : function(component, event, helper) {
       console.log('calling child method');
       
        var action = component.get("c.sampleCallout"); 
        action.setCallback(this, function(result){
            var messageLog = result.getReturnValue();
            console.log('---messageLog-- ' + messageLog);
            component.set("v.messageLog", messageLog);
            
        });
        var childCmp = component.find("MessagePanel");
        var retnMsg = childCmp.executeMyMethod(messageLog);
        consolo.log('executing child');
        
        $A.enqueueAction(action);      
        
	}
 
Child component:
<aura:component access="global">	
    <aura:method name="executeMyMethod" action="{!c.executeMyMethod}">
         <aura:attribute name="messageLog" type="MessageLog__c" />
    </aura:method>	
</aura:component>

Controller:
executeMyMethod : function (component, event, helper) {
        var params = event.getParam('arguments');
        if (params) {
            var param1 = params.MessageLog__c;
			console.log('param1  ' + param1);
            component.set('v.messageLog',params.MessageLog__c);
            
        }
    }

Thank you for your help
Hello All,

I have Picklist Field A with 16 values and picklist field B with 2 values(Mail/Email). Few values in Picklist A should have both email and mail so that user can select one. Few should have only one either mail/Email.  This is in lightning.

Please let me know the ways to do it.

Thank you for your help.
 
I have a scenario where I need to create records in a custom object whenever an exceptioin occurs(Dml,email,async or any other types of exceptions). I have written a gerneric apex class to create records. Whenever exception occurs, in the catch block I am calling a method to create a excetion record.
Below is my code. I am thinking of a workaround to bulkify the below code.
public static void testDMLUpdate(Test_CDI__c[] newData){
        for(Test_CDI__c T: newData){
            
            if(T.Debug_Field__c == null){
                Test_CDI_2__c test = new Test_CDI_2__c();
                test.Name = 'Debug filed is null';
                try{
                	insert test;
                    system.debug('inserting the record no exctption fired');
                }
                catch(exception e){
                    CDI_MessageLogger.logException(e, T.Id);
                }
            }
        }
    }

I know writing a dml operation in the for loop is bad. but I need to capture the Id of the record causing the exception.  CDI_MessageLogger.logException(e, T.Id); is the method creating record in the custom object for each exception.

Thanks in advance.
I am trying to increase the width of lightning quick action. Tried many ways by reviewing different blogs. But no luck. Please help.
 
<aura:component controller="MassUpdate" implements="flexipage:availableForRecordHome,flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global" >
	<aura:attribute name="data" type="customObject__c[]"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="draftValues" type="Object" default="[]"/>
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.Doit}"/> 
    <ltng:require styles="{!$Resource.Model_Width_Expand + '/main.css'}"/> 
    <div  >
      
        <lightning:datatable
            columns="{!v.columns }"
            data="{!v.data }"
            keyField="Id"    
            onsave="{!c.handleSaveEdition}"                 
        />
    </div> 
   
</aura:component>

 
I am trying to mass update child records with a lightning quck action on the parent record detail page. Not sure what is wrong with this code. I appreciate your help.
Component 

<aura:component controller="MassUpdateController " implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
	<aura:attribute name="data" type="object__c[]"/>
    <aura:attribute name="columns" type="List"/>
    <aura:attribute name="recordId" type="String"/>
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.init }"/>        
    <div style="height: 300px">
        <lightning:datatable
            columns="{! v.columns }"
            data="{! v.data }"
            keyField="id"                 
        />
    </div>
</aura:component>


Controller:

({
	
		init: function(cmp,event, helper) {
        cmp.set('v.columns', [
            {label: 'Name', fieldName: 'Name', type: 'text'  }            
          //  {label: 'Provider Email', fieldName: 'ProviderEmail', type: 'email', editable: true },
          //  {label: 'Not Associated to this Location', fieldName: 'NotAssociatedToThisLocation', type: 'checkbox' }
            
        ]);
        helper.fetchData(cmp,event, helper);        
	}
})


Helper

({
    fetchData: function (cmp,event,helper) {
        var RecordId = component.get("v.recordId");
        action.setParams({
        	"recordId" : RecordId
    	});
        var action = cmp.get("c.getRecords");
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var data = response.getReturnValue();
                cmp.set('v.data',data);
            }
            // error handling when state is "INCOMPLETE" or "ERROR"
        });
        $A.enqueueAction(action);
    }
})

Apex Controller

public class MassUpdateController {
	@AuraEnabled
    public static list<Managed_Care_Provider__c> getRecords(Id recordId){
        system.debug(' record Id ' + recordId);
        list<object__c> lstMC = [SELECT Id,Name from Object__c where Opportunity__c=: recordId];
        system.debug('---- list of MC ' + lstMC);
        return lstMC;
    }
}