• Stefano Portelli +
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hi all,
I would like to have your opinion about the way to delete all the account when a custom field assumes a specific value.
The additional information that I have are the following:
  1. The Account object has relationships with 40 custom objects with lookup relationship (no master detail, sorry)
  2. Each custom object can have 20-100 records related to the account
  3. I need to delete about 2k account each days
  4. I need to log what account was deleted and what not deleted with error info in order to perform manual correction
IDEA 1
An idea could be to create a process builder that will invoke a visual workflow as a scheduled action.
The Visual Workflow will use fast lookup for each of the custom object and then fast delete the records.
Questions about this idea:
  1. Since the flow is executed as a scheduled action, it will executed as an async process?
  2. Is suggested to report the progress of deletion process during the flow, inserting record on a custom object?
  3. How to limit the number of flow executed at the same time?
IDEA 2
Write an apex class that will invoked as a call-in with queuable interface. The apex will receive the Account ID from an external ESB

Questions about this idea:
  1. What are the way I can invoke this Apex class?
  2. What are the limitation that I need to take in consideration?
  3. Is there a way to provide to the Apex more than one AccountID?
  4. What is the suggested way to log the status of each delete operation?
Additional question:
  1. Shall I take in consideration sync interaction or it is better to mantain an async perspective?
Thanks in advance
Hi all,

I'm blocked with this trail because I receive the following error:

The Apex controller CampingListController doesn't have a 'getItems()' or 'saveItem(Camping_Item__c item)' method.

Has anyone run across this problem before?
Following my code, thanks in advance!

campingList.cmp (COMPONENT)
<aura:component controller="CampingListController">
    
	<aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{'sobjectType' : 'Camping_Item__c',
                               'Quantity__c' : 0,
                               'Price__c' : 0}"/>

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
  <!-- BOXED AREA -->
  <fieldset class="slds-box slds-theme--default slds-container--small">

    <legend id="newCampItemForm" class="slds-text-heading--small 
      slds-p-vertical--medium">
      Add Camping Item
    </legend>

    <!-- CREATE NEW CAMPING ITEM FORM -->
    <form class="slds-form--stacked">

      <lightning:input aura:id="itemform" 
                       label="Name"
                       name="itemname"
                       value="{!v.newItem.Name}"
                       required="true"
                       messageWhenValueMissing="Name is required"/>

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Quantity"
                       name="quantityfield"
                       value="{!v.newItem.Quantity__c}"
                       min="1"
                       required="true"
                       messageWhenValueMissing="Quantity is required"/>

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Price"
                       name="price"
                       value="{!v.newItem.Price__c}"
                       formatter="currency"
                       step="0.1"/>

      <lightning:input type="checkbox" 
                       aura:id="itemform" 
                       label="Packed?"
                       name="packed"
                       checked="{!v.newItem.Packed__c}"/>

      <lightning:button label="Create Camping Item"
                        variant="brand"
                        onclick="{!c.clickCreateItem}"/>

    </form>
    <!-- / CREATE NEW CAMPING ITEM FORM -->

  </fieldset>
    
        <div class ="slds-card slds-p-top--meduim">
        <header class ="slds-card__header">
            <h3 class = "slds-text-heading--small">Items</h3>
        </header>

        <section class ="slds-card__body">
        	<div id="list" class = "row">
            	<aura:iteration items="{!v.items}" var="item">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>

    </div>

</aura:component>

campingListController.js (CONTROLLER)
({
	clickCreateItem : function(component, event, helper) 
    {

        //  check for validation
        var checkField = component.find("itemform").reduce(
            function (validSoFar, inputCmp) 
            {
            	// Displays error messages for invalid fields
            	inputCmp.showHelpMessageIfInvalid();
            	return validSoFar && inputCmp.get('v.validity').valid;
        	}, true);

        if (checkField)
        {
            //  gets reference to view's newItem attribute
            var newItem = component.get("v.newItem");
            console.log("Create Camping Item: " + JSON.stringify(newItem));
            helper.createItem(component, newItem);                                                   
        }
        
	},
    
    // Load items from Salesforce
    doInit: function(component, event, helper) 
    {
        // Create the action
        var action = component.get("c.getItems");
        // Add callback behavior for when response is received
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
        // Send action off to be executed
        $A.enqueueAction(action);
    }
    
    
})



campingListHelper.js (HELPER)
({
	createItem : function(component, newItem) 
    {
        var action = component.get("c.saveItems");
        action.setParams({
            "item": newItem
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var items = component.get("v.items");
                items.push(response.getReturnValue());
                component.set("v.items", items);
            }
        });
        $A.enqueueAction(action);
		
	}
})



CampingListController.apxc (APEX CLASS)
public with sharing class CampingListController {

	@AuraEnabled
    public static List<Camping_Item__c> getItems() {
        
        // Check to make sure all fields are accessible to this user
        String[] fieldsToCheck = new String[] {
            'Id', 'Name', 'Quantity__c', 'Price__c', 'Packed__c'
        };
        
        Map<String,Schema.SObjectField> fieldDescribeTokens = 
            Schema.SObjectType.Camping_Item__c.fields.getMap();
        
        for(String field : fieldsToCheck) {
            if( ! fieldDescribeTokens.get(field).getDescribe().isAccessible()) {
                throw new System.NoAccessException();
            }
        }
        
        // OK, they're cool, let 'em through
        return [SELECT Id, Name, Quantity__c, Price__c, Packed__c  
                FROM Camping_Item__c];
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItems(Camping_Item__c items) {
        // Perform isUpdatable() checking first, then
        upsert items;
        return items;
    }    
    
}


 
Hi all,

with a splunk query of the following type:
index=XX CASE(XXXX) logRecordType=axque | stats count by status

I'm able to collect info about how many jobs of each types was executed on a specific timeframe and I have the following numbers:

Completed: 332565
Failed: 386
Processing: 332777
Queued: 375279

Looking at the number I understand the 375k was queued but why only 332 was completed? What happened to the "missing" 375-332=33k jobs?

Putting the data on a chart I have the following picture:

User-added image

Here is the splunk query used to get this info:
index=XX CASE(XXX) logRecordType=axque status!=Processing | timechart span=1h count by status

Thanks in advance,
Stefano
 
A customer of mine is looking for options for 24 x 7 uninterrupted service given the nature of their business and high volume of emergency calls . They are looking for system access in update mode even during the scheduled maintenance windows, they are asking if there is a way to have two different orgs synced and in case of a fault scenario the connected users shall not relogin...
Hi all,
is there a declarative way to share a standard object's record with an end date? I would like to share an Opportunity or a Contact with someone else (with the same profile that I have) and this sharing rule shall be revoked automagically once end date is reached.
Will process builder be able to fulfill this requirement or shall I use Apex code?

Thanks in advance,
Stefano
Hi all,

I'm blocked with this trail because I receive the following error:

The Apex controller CampingListController doesn't have a 'getItems()' or 'saveItem(Camping_Item__c item)' method.

Has anyone run across this problem before?
Following my code, thanks in advance!

campingList.cmp (COMPONENT)
<aura:component controller="CampingListController">
    
	<aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{'sobjectType' : 'Camping_Item__c',
                               'Quantity__c' : 0,
                               'Price__c' : 0}"/>

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
  <!-- BOXED AREA -->
  <fieldset class="slds-box slds-theme--default slds-container--small">

    <legend id="newCampItemForm" class="slds-text-heading--small 
      slds-p-vertical--medium">
      Add Camping Item
    </legend>

    <!-- CREATE NEW CAMPING ITEM FORM -->
    <form class="slds-form--stacked">

      <lightning:input aura:id="itemform" 
                       label="Name"
                       name="itemname"
                       value="{!v.newItem.Name}"
                       required="true"
                       messageWhenValueMissing="Name is required"/>

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Quantity"
                       name="quantityfield"
                       value="{!v.newItem.Quantity__c}"
                       min="1"
                       required="true"
                       messageWhenValueMissing="Quantity is required"/>

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Price"
                       name="price"
                       value="{!v.newItem.Price__c}"
                       formatter="currency"
                       step="0.1"/>

      <lightning:input type="checkbox" 
                       aura:id="itemform" 
                       label="Packed?"
                       name="packed"
                       checked="{!v.newItem.Packed__c}"/>

      <lightning:button label="Create Camping Item"
                        variant="brand"
                        onclick="{!c.clickCreateItem}"/>

    </form>
    <!-- / CREATE NEW CAMPING ITEM FORM -->

  </fieldset>
    
        <div class ="slds-card slds-p-top--meduim">
        <header class ="slds-card__header">
            <h3 class = "slds-text-heading--small">Items</h3>
        </header>

        <section class ="slds-card__body">
        	<div id="list" class = "row">
            	<aura:iteration items="{!v.items}" var="item">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>

    </div>

</aura:component>

campingListController.js (CONTROLLER)
({
	clickCreateItem : function(component, event, helper) 
    {

        //  check for validation
        var checkField = component.find("itemform").reduce(
            function (validSoFar, inputCmp) 
            {
            	// Displays error messages for invalid fields
            	inputCmp.showHelpMessageIfInvalid();
            	return validSoFar && inputCmp.get('v.validity').valid;
        	}, true);

        if (checkField)
        {
            //  gets reference to view's newItem attribute
            var newItem = component.get("v.newItem");
            console.log("Create Camping Item: " + JSON.stringify(newItem));
            helper.createItem(component, newItem);                                                   
        }
        
	},
    
    // Load items from Salesforce
    doInit: function(component, event, helper) 
    {
        // Create the action
        var action = component.get("c.getItems");
        // Add callback behavior for when response is received
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
        // Send action off to be executed
        $A.enqueueAction(action);
    }
    
    
})



campingListHelper.js (HELPER)
({
	createItem : function(component, newItem) 
    {
        var action = component.get("c.saveItems");
        action.setParams({
            "item": newItem
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var items = component.get("v.items");
                items.push(response.getReturnValue());
                component.set("v.items", items);
            }
        });
        $A.enqueueAction(action);
		
	}
})



CampingListController.apxc (APEX CLASS)
public with sharing class CampingListController {

	@AuraEnabled
    public static List<Camping_Item__c> getItems() {
        
        // Check to make sure all fields are accessible to this user
        String[] fieldsToCheck = new String[] {
            'Id', 'Name', 'Quantity__c', 'Price__c', 'Packed__c'
        };
        
        Map<String,Schema.SObjectField> fieldDescribeTokens = 
            Schema.SObjectType.Camping_Item__c.fields.getMap();
        
        for(String field : fieldsToCheck) {
            if( ! fieldDescribeTokens.get(field).getDescribe().isAccessible()) {
                throw new System.NoAccessException();
            }
        }
        
        // OK, they're cool, let 'em through
        return [SELECT Id, Name, Quantity__c, Price__c, Packed__c  
                FROM Camping_Item__c];
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItems(Camping_Item__c items) {
        // Perform isUpdatable() checking first, then
        upsert items;
        return items;
    }    
    
}


 
Hi all,
is there a declarative way to share a standard object's record with an end date? I would like to share an Opportunity or a Contact with someone else (with the same profile that I have) and this sharing rule shall be revoked automagically once end date is reached.
Will process builder be able to fulfill this requirement or shall I use Apex code?

Thanks in advance,
Stefano