• piyush.mathur
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi All 

I am facing issue in lightning component hosted in community and force.com site.
I have modal popup where I am showing the list of menu items selected and asking for user/customer details to enter. 
Accessing the link through any mobile browser and when the modal opens to enter the details in input text the modal shrinks.

I have tried focusing on input text but not working.
Want the modal to focus on input text when keyboards opens/ or modal scrolls to bottom. 
Not sure what's the correct approach for achieving with this lightning components tags.User-added imageUser-added imageUser-added image
Hi, 

Our initial goal is to have a trigger fire a callout with a large amount of inserted records.

I have a trigger, which triggers a future callout from an apex class.

Trigger:
trigger pushMessageTrigger on TMP_Push_Messages__c (after insert) {
     Plexure.PushMessage(Trigger.newMap.keySet());
}

Apex class: 
global class Plexure{
   @future(callout=true)
   public static void PushMessage(Set<Id> pushMessageIds) {
       List<TMP_Push_Messages__c> messages = [select consumerId__c, messageId__c from TMP_Push_Messages__c where Id IN :pushMessageIds];

       for (TMP_Push_Messages__c message: messages) {
           try {
                // Generate guid
                Blob b = Crypto.GenerateAESKey(128);
                String h = EncodingUtil.ConvertTohex(b);
                String guid = h.SubString(0,8)+ '-' + h.SubString(8,12) + '-' + h.SubString(12,16) + '-' + h.SubString(16,20) + '-' + h.substring(20);
                Http http = new Http();
                HttpRequest req = new HttpRequest();
      req.setEndpoint('https://xxxxxxxxxxxxxxxx.com/xxx/xxxxxxxx/'+message.consumerId__c+'/xxxxxxxxxxx');
                req.setBody('{"messageId" : "'+message.messageId__c+'", "requestId" : "'+guid+'"}');
                req.setMethod('POST');
                req.setHeader('Authorization', 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
                req.setHeader('x-vmob-authorization', ’xxxxxxxxxxxxxxxxxxxxxxx’);
                HTTPResponse res = http.send(req);
            } catch (Exception e) {
               System.debug(e);
            }
       }
    }
}


I found out that it is not possible to trigger callout methods unless it has ‘@future(callout=true)’ notation and it’s not possible to pass Lists into @future methods. (Also, looked up that it’s a better practice to use ‘Trigger.newMap.keySet()’ in the trigger from this article: https://developer.salesforce.com/page/Best_Practice:_Use_future_Appropriately).

When inserting more than 100 records, an error occurs ‘Too many callouts: 101’ in the log, and I am aware that it happens because of the 100 callout limitation.
Please assist with a possible solution/workaround on how avoid hitting the limit?
Hello,

I am struggling with this trailhead challenge. I passed the challenge, but it doesn't work, when I do manually in the browser:

Repro:
Preview the camping app
Create a new camping item
Callback function return error state. 

This is my code:
camping list component:
<aura:component controller="CampingController">
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c" 
                    default="{'sObjectType':'Camping_Item__c', 'Price__c':0, 'Quantity__c':0}"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <form>
    	<ui:inputText aura:id="name" label="Name" value="{!v.newItem.Name}" required="true"/>
        <ui:inputNumber aura:id="quantity" label="Quantity" value="{!v.newItem.Quantity__c}" required="true"/>
        <ui:inputCurrency aura:id="price" label="Price" value="{!v.newItem.Price__c}" required="true"/>
        <ui:inputCheckbox aura:id="packed" label="Packed?" value="{!v.newItem.Packed__c}"/>
        <ui:button label="Create Item" press="{!c.clickCreateItem}"/>
    </form>
    
    <aura:iteration items="{!v.items}" var="item">
        <c:campingListItem item="{!item}"/>
    </aura:iteration>
    
</aura:component>

camping list controller: 
 
({
     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 (component.isValid() && state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
    
        // Send action off to be executed
        $A.enqueueAction(action);
    },   
	clickCreateItem : function(component, event, helper) {
        if(helper.validateItem(component)){
            // Create the new expense
            var newItem = component.get("v.newItem");
            console.log("Create Item: " + JSON.stringify(newItem));
            helper.createItem(component, newItem);
        }
  
	}
})

camping list helper:
({
	validateItem : function(component) {
		var validItem = true;
        
        var nameField = component.find("name");
        var itemName = nameField.get("v.value");
        
        var priceField = component.find("price");
        var itemPrice = priceField.get("v.value");
        
        var quantityField = component.find("quantity");
        var itemQuantity = quantityField.get("v.value");
        
        if ($A.util.isEmpty(itemName)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        } else {
            nameField.set("v.errors", null);
        }
        
        if ($A.util.isEmpty(itemPrice)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        } else {
            priceField.set("v.errors", null);
        }
        
        if ($A.util.isEmpty(itemQuantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        } else {
            quantityField.set("v.errors", null);
        }	
        console.log("valid: " + validItem);
        return validItem;
	},
    createItem: function(component, newItem) {
    	var action = component.get("c.saveItem");
        action.setParams({"newItem":newItem});

    	action.setCallback(this, function(response){
        	var state = response.getState();
            console.log("state: " + state);
        	if (component.isValid() && state === "SUCCESS") {
            	var items = component.get("v.items");
            	items.push(response.getReturnValue());
            	component.set("v.items", items);
                
                component.set("v.newItem",{'sobjectType':'Camping_Item__c',
                                   'Name': '',
                                   'Quantity__c': 0,
                                   'Price__c': 0,
                                   'Packed__c': false}); 
        	}
    	});
    	$A.enqueueAction(action);
                
    },
})

Server side camping controller:
({
	validateItem : function(component) {
		var validItem = true;
        
        var nameField = component.find("name");
        var itemName = nameField.get("v.value");
        
        var priceField = component.find("price");
        var itemPrice = priceField.get("v.value");
        
        var quantityField = component.find("quantity");
        var itemQuantity = quantityField.get("v.value");
        
        if ($A.util.isEmpty(itemName)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        } else {
            nameField.set("v.errors", null);
        }
        
        if ($A.util.isEmpty(itemPrice)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        } else {
            priceField.set("v.errors", null);
        }
        
        if ($A.util.isEmpty(itemQuantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        } else {
            quantityField.set("v.errors", null);
        }	
        console.log("valid: " + validItem);
        return validItem;
	},
    createItem: function(component, newItem) {
    	var action = component.get("c.saveItem");
        action.setParams({"newItem":newItem});

    	action.setCallback(this, function(response){
        	var state = response.getState();
            console.log("state: " + state);
        	if (component.isValid() && state === "SUCCESS") {
            	var items = component.get("v.items");
            	items.push(response.getReturnValue());
            	component.set("v.items", items);
                
                component.set("v.newItem",{'sobjectType':'Camping_Item__c',
                                   'Name': '',
                                   'Quantity__c': 0,
                                   'Price__c': 0,
                                   'Packed__c': false}); 
        	}
    	});
    	$A.enqueueAction(action);
                
    },
})
It seems there is a problem wth the invocation of the saveItem-method. The response is always 'ERROR'
What I am missing here? I'm getting crazy....
Thank you for any hints
Hello,
I defined by BigObject as per the instructions. 
I created the following files:
package.xml
SalesTargets__b.object
SalesTargets__BigObject.permissionset

I created a zip file and uploaded through the workbench using the Deploy interface in my sandbox. 

I am getting a success statusWorkbench Status for SalesTargets__b

But the BigObject is not in my sandbox. Is there something I am missing