Service Board > Service Board for Implementers > Post-Sync Configuration Tasks > Configuring Retry Quick Actions for Lightning Experience
Configuring Retry Quick Actions for Lightning Experience
In Salesforce Classic, you can create a Retry button to rerun failed Outbound Queue records. Although Lightning Experience doesn't support buttons configured with JavaScript onClick, you can configure a Quick Action to retry Outbound Queue records.
To configure Retry Quick Actions for Lightning Experience:
1. In Lightning Experience, on the Salesforce Setup page, in the left pane, in the Platform Tools section, expand the Custom Code node, and then click Apex Classes.
2. On the Apex Classes page, cilck New, and then add and save the following code.
/*
* Apex controller that currently contains only one method to retry outbound queue record
*/
global class RetryOBQueueController {

@AuraEnabled
public static String retryOutboundRecord(String outboundRecordId) {
SVMXC__SM_SB_Queue_Outbound__c queueRecord = [SELECT SVMXC__SM_Status__c,SVMXC__SM_Event_type__c,SVMXC__SM_Record_to_dispatch__c,SVMXC__SM_Object_Name__c,SVMXC__SM_Payload__c FROM SVMXC__SM_SB_Queue_Outbound__c WHERE Id = :outboundRecordId];
String status = queueRecord.SVMXC__SM_Status__c;
String eventType = queueRecord.SVMXC__SM_Event_Type__c;
String sObjectRecordId = queueRecord.SVMXC__SM_Record_to_dispatch__c;
String objectName = queueRecord.SVMXC__SM_Object_Name__c;
String payload = queueRecord.SVMXC__SM_Payload__c;
SVMXSB.SB_SendFailedRecords.retryFailedRecord(outboundRecordId,status,eventType,sObjectRecordId,objectName,payload);
return 'Success';
}
}
3. In the Developer Console, on the File menu, under the New node, click Lightning Component, and then in the New Lightning Bundle dialog box, complete the fields as follows and click Submit.
Field
Value
Name
RetryOBQueue
Lightning Quick Action check box
Selected
4. On the RetryOBQueue.cmp tab, in the right pane, in the RetryOBQueue table, in the Controller row, click Create to create the RetryOBQueueController.js tab, and then add and save the following code to the RetryOBQueueController.js and RetryOBQueue.cmp tabs.
RetryOBQueueController.js
({
init : function(component, event, helper) {
var outboundRecordId = component.get("v.recordId");
var action = component.get("c.retryOutboundRecord");
action.setParams({"outboundRecordId": outboundRecordId});
action.setCallback(this, function(response) {
var state = response.getState();
if(component.isValid() && state == "SUCCESS"){
$A.get("e.force:closeQuickAction").fire();
window.location.reload(true);
} else {
component.set("v.messageError", true);
}
});
$A.enqueueAction(action);
}
})
RetryOBQueue.cmp
<aura:component controller="RetryOBQueueController" implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickAction" >
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<aura:if isTrue="{!v.messageError}">
<!-- Load error -->
<div class="userCreateError">
<ui:message title="Error" severity="error" closable="true">
Unable to retry outbound queue record. Please review your data and try again.
</ui:message>
</div>
<aura:set attribute="else">
<div class="slds-text-heading_large">Outbound queue record has been retried.</div>
</aura:set>
</aura:if>
</aura:component>
5. On the Salesforce Setup page, in the left pane, in the Platform Tools section, under the Objects and Fields node, click Object Manager, and then in the list view, locate and click SB Queue Outbound.
6. On the SB Queue Outbound object page, in the left pane, click Buttons, Links, and Actions, and then in the top right corner, click New Action.
7. On the New Action page, complete the fields as follows, and then click Save.
Field
Value
Action Type
Lightning Component
Lightning Component
c:RetryOBQueue
Label
Retry
Name
Retry
8. On the SB Queue Outbound object page, in the left pane, click Page Layouts, and then in the right pane, in the list view, click SB Queue Outbound Layout.
9. On the SB Queue Outbound Layout page, in the left pane, click Mobile & Lightning Actions, and then drag and drop the Retry action from the upper grid into the Salesforce Mobile and Lightning Experience Actions section, between the Edit and Printable View buttons and save the layout.
For more information:
Was this helpful?