• Jake Bullard
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 10
    Replies

Alright guys, I have what I feel like is a simple question. I want to show a map within a related map. I have written a controller and page to do that but for some reason the submap doesn't repeat. I only get the first record on the sub map. 

 

Controller

public class PaymentGroupController {
    
    
    List<Orders__c> OrderList = [select Id, Name WHERE Payment_Group__c = :ApexPages.currentPage().getParameters().get('id')];
        
    Map<Id, Orders__c> orderMap = new Map<Id, Orders__c>(OrderList);
    
    Map<Id, Order_Item__c> itemMap = new Map<Id, Order_Item__c>();

    public PaymentGroupController(){
        
        for(Orders__c o:OrderList){
                string oId = o.Id;

                List<Order_Item__c> itemList = [Select Job_Name__C where  Taradel_Orders__c=:o.id];
              for(Order_Item__c i:itemList){
                    itemMap.put(oId, i );
                
                }
                    
         }               
   }

   public Map<Id, Orders__c> getOrderMap(){
   return orderMap;

   }

   public Map<Id, Order_Item__c> getitemMap(){
   return itemMap;

   }

}

Visualforce:

<apex:page controller="PaymentGroupController" docType="html-5.0" title="Your Invoice" id="YourInvoice" sidebar="false" cache="false" showHeader="false" standardStylesheets="true">
<apex:repeat value="{!orderMap}" var="key">
    <apex:repeat value="{!orderMap[key]}" var="map"> 
    <!--this should repeat all the Order__c found and it does-->                                
        <Apex:outputText value="{!map.name}"/> <br></br>
        <apex:repeat value="{!itemMap[map]}" var="submap">     
           <!--this should repeat all the Order_Items__c found under the Orders_c repeated above and it only outputs the first item in the map-->
            <Apex:outputText value="{!submap.Job_Name__c}"/><br></br> 
        </apex:repeat>
    </apex:repeat>
</apex:repeat> 
</apex:page>

Hey guys, 

I have an interesting challenge that I'm not sure how to solve. 

We have a group of reps that we would like to queue up calls for. Rather than assigning them out in a round robin fashion we would like to leave all the leads in a queue until such time the rep hits a button to request a lead. At that point they should have exclusivity on the lead and when other people hit the same button a different lead should be displayed for them. 


I first thought to create this in a flow that does a lookup, and then an immediant field update to set the status as "Working". That status will exclude them from the lookup.

Unforuntly if 2 people hit the button at near the same time the flow is too slow and the same lead comes up for both. 

 

How would you solve this? Would apex code be fast enough to ellivate this concern? If not is there another option I'm not considering?

Thanks!

Hey guys I have a super simple lightning component that uses a list variable and the iternate function. But I hit a road block when I go to say the Design so I can pass data to that variable in my flow. I get the error below. 
 

The lightning:availableForFlowScreens interface doesn't support these attribute types in the design resource: list. : Source
 

Any suggestions on a work around for this? 


Cmp

<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="OrderList" type="List" default="1,2,3,3,3" />
    <aura:attribute name="AmountToOrder" type="decimal"/>
	 <aura:iteration items="{! v.OrderList }" var="item">
        <p>{!item }<lightning:input type="Decimal" name="AmountToOrder" aura:id="AmountToOrder" value="{!v.AmountToOrder}" style="width: 50px; "/></p>
    </aura:iteration>
</aura:component>
 


 

Hey guys, 

How can I hide the scroll bar in on and Iframe in a lightning cmp? Here is what Ive tried.

Cmp
<aura:component access="global" implements="lightning:availableForFlowScreens">
<iframe src="{!v.iFrameURL}" height="{!v.iFrameheight+'px'}" width="{!v.iFramewidth+'px'} "frameborder="0" class="over"/>                                                                                                                             
</aura:component>


CSS

.THIS.over {
    overflow-y: hidden;
    overflow-x: hidden;

}

Hey guys I have an issue I'm hoping you can help with. I'm a little new to Apex but figuring it out (I think). I have a really awesome unmanaged package that assigns leads/cases (link) and it works great on the lead but I wanted to use it on a custom object. So I thought now problem, I'll just add a trigger for the custom object and modify the other bits to work. 

So I built the trigger and it works great and at the end it calls an apex class which should finish off what the trigger started. But the weird thing is the apex class returns nothing in to SOQL query. However when the trigger is hit again (to assign another record) the SOQL query runs and finds the previous record. It's like the apex class SOQL query is running before the trigger finishes updating. The lead assignment works in the same way and has no issues.

My questions are: 

1. Why is this happening? 

2. Why did the orginal developer build it this way? Why have the seperate APEX class? Couldn't it all be done within the trigger? Just wondering for the sake of learning. 


Here is the orginal trigger: 

 

trigger FireLeadDistribution on Lead (before insert, before update) {
    
Set<String> setLeadcriteria= new Set<String>();    
    for ( Lead objLead : Trigger.new)  {        
        setLeadcriteria.add(objLead.distributionValue__c);
    }

    Map<Id, Receiver__c>updtReceivers = new Map<Id,Receiver__c>();
    Map<Id, Distributor__c>updtDistributors = new Map<Id,Distributor__c>();
    List<Id> leadIds = new LIst<Id>();
  
    Receiver__c[] receiver = [SELECT name,distributor__r.distributioncount__c,distributorstatus__c, id,relateduser__c ,
    distributionValue__c, recordsreceived__c,LastDistributionTime__c,distributor__r.sumofquotas__c,
    first__c,last__c,position__c FROM Receiver__c WHERE distributionValue__c =: setleadcriteria 
    AND Status__c = 'Active' AND UserStatus__c = 'OK' AND DistributorStatus__c = 'Active' AND distributorObject__c = 'Lead'
    ORDER BY distributionValue__c, position__c LIMIT 1000];
        
    for(Lead lid : trigger.new){
       
        if(lid.distributionValue__c != null && lid.isDistributed__c == false && lid.isconverted == false ){
            for(integer i=0;i< receiver.size();i++){ // loop through receivers
                if(lid.distributionValue__c == receiver[i].distributionValue__c){
                 
                    Integer leadCount = integer.valueof(receiver[i].distributor__r.distributioncount__c);                  
                    Integer quotasSum = integer.valueof(receiver[i].distributor__r.sumofquotas__c);      
                    Integer remainder = math.mod(leadCount , quotasSum );
                    
                   
                   if(remainder >= receiver[i].first__c && remainder <= receiver[i].last__c ){ 
                                        
                       receiver[i].recordsreceived__c = receiver[i].recordsreceived__c+1;
                       receiver[i].distributor__r.distributioncount__c = receiver[i].distributor__r.distributioncount__c+1;

                       receiver[i].LastDistributionTime__c = system.now();

                       lid.receiverID__c = receiver[i].relateduser__c ;
                       lid.isDistributed__c = true ;
                       leadids.add(lid.id);
                                              
                       updtReceivers.put(receiver[i].id, receiver[i]);
                       updtDistributors.put(receiver[i].Distributor__c,receiver[i].distributor__r); 
                       
                       break;
                   }
                }
                
                              
            }//end for "i"
        }    
    }// end for "lid"
    if(updtReceivers.size()>0){
        update updtReceivers.values();
    }
    if(updtDistributors.size()>0){
        update updtDistributors.values();
    }
    if(leadids.size()>0){
        DistributorsAssignment.LeadAssignment(leadids);  
    }   
}


Here is my trigger:

trigger FireOrderItemDistributionPreflight on Order_Item__c (before insert, before update) {

Set<String> setOrderItemcriteria= new Set<String>();    
    for ( Order_Item__c objOrderItem : Trigger.new)  {        
        setOrderItemcriteria.add(objOrderItem.PreflightDistributionValue__c);
    }

    Map<Id, Receiver__c>updtReceivers = new Map<Id,Receiver__c>();
    Map<Id, Distributor__c>updtDistributors = new Map<Id,Distributor__c>();
    List<Id> itemids = new List<Id>();
  
    Receiver__c[] receiver = [SELECT name,distributor__r.distributioncount__c,distributorstatus__c, id,relateduser__c ,
    distributionValue__c, recordsreceived__c,LastDistributionTime__c,distributor__r.sumofquotas__c,
    first__c,last__c,position__c FROM Receiver__c WHERE DistributionValue__c =: setOrderItemcriteria
    AND Status__c = 'Active' AND UserStatus__c = 'OK' AND DistributorStatus__c = 'Active' AND distributorObject__c = 'Order Item'
    ORDER BY distributionValue__c, position__c LIMIT 1000];
        
    for(Order_Item__c oid : trigger.new){
       
        if(oid.PreflightDistributionValue__c != null && oid.isPreflightDistributed__c == false ){
            for(integer i=0;i< receiver.size();i++){ // loop through receivers
                if(oid.PreflightDistributionValue__c == receiver[i].distributionValue__c){
                 
                    Integer OrderItemCount = integer.valueof(receiver[i].distributor__r.distributioncount__c);                  
                    Integer quotasSum = integer.valueof(receiver[i].distributor__r.sumofquotas__c);      
                    Integer remainder = math.mod(OrderItemCount , quotasSum );
                    
                   
                   if(remainder >= receiver[i].first__c && remainder <= receiver[i].last__c ){ 
                                        
                       receiver[i].recordsreceived__c = receiver[i].recordsreceived__c+1;
                       receiver[i].distributor__r.distributioncount__c = receiver[i].distributor__r.distributioncount__c+1;

                       receiver[i].LastDistributionTime__c = system.now();

                       oid.PreflightReceiverID__c = receiver[i].relateduser__c ;
                       oid.isPreflightDistributed__c = true ;
                       itemids.add(oid.id);
                       
                       updtReceivers.put(receiver[i].id, receiver[i]);
                       updtDistributors.put(receiver[i].Distributor__c,receiver[i].distributor__r); 
                       
                       break;
                   }
                }
                
                              
            }//end for "i"
        }    
    }// end for "Oid"
    if(updtReceivers.size()>0){
        update updtReceivers.values();
    }
    if(updtDistributors.size()>0){
        update updtDistributors.values();
    }
    if(itemids.size()>0){
        DistributorsAssignment.ItemPreflightAssignment(itemids);  
    }   
}

Here is the class they both trigger:

public with sharing class DistributorsAssignment {
    @future 
    public static void LeadAssignment(list<id> leadids ) {
    
        List<Lead> assignWithoutNotif = new List<Lead>();
        
        Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;    
     
        for(Lead lidz : [SELECT Id,ownerid, receiverID__c FROM Lead WHERE isdistributed__c = true AND receiverID__c != NULL]){

                lidz.OwnerId = lidz.receiverID__c ; 
                lidz.receiverID__c = NULL;
                                     
                lidz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(lidz);
            
        }  
       if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
        
    }
    public static void CaseAssignment(list<id> Caseids ) {
    
        List<Case> assignWithoutNotif = new List<Case>();

        
        Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;    
      
        for(Case kasz : [SELECT Id,ownerid, receiverID__c FROM Case WHERE isdistributed__c = true AND receiverID__c != NULL]){

                kasz.OwnerId = kasz.receiverID__c ; 
                kasz.receiverID__c = '';

                kasz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(kasz);
           
        }  
        if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
       
    }
	public static void ItemPreflightAssignment(list<id> itemIds ) {
    
        List<Order_Item__c> assignWithoutNotif = new List<Order_Item__c>();
            
		Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;
     
        for(Order_Item__c oidz : [SELECT Id,Preflighter__c, PreflightReceiverID__c FROM Order_Item__c WHERE isPreflightDistributed__c = true AND PreflightReceiverID__c != NULL]){

                oidz.Comments__c = 'test' ;
            	oidz.Preflighter__c = oidz.PreflightReceiverID__c ;
                oidz.PreflightReceiverID__c = NULL;
				
				oidz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(oidz);
            
        }
		if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
        
    }
    
	public static void ItemSenderAssignment(list<id> Itemids ) {
    
        List<Order_Item__c> assignWithoutNotif = new List<Order_Item__c>();

     
        for(Order_Item__c Oidz : [SELECT Id,Sender__c, SenderReceiverID__c FROM Order_Item__c WHERE isSenderDistributed__c = true AND SenderReceiverID__c != NULL]){

                Oidz.Sender__c = Oidz.SenderReceiverID__c ; 
                Oidz.SenderReceiverID__c = NULL;

            
        }
        
    }
    
}

Hey guys,

Here is a fun one, I am working on disabling a button unless a checkbox disclaimer is checked. I wrote a little controller that should check the checkbox value and depending on whether it's true or false, update the disabled boolean to the inverse. It works on the first change when I check the box the diabled flag goes to false. However when I uncheck the box it doesn't update that boolean. What am I doing wrong? Thanks!

Examples screenshots
This is correct. 

User-added image
This is correct. 
User-added image
This is not, the button value should be true
User-added image

Cmp code 
 

<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="proofSelection" type="String"/>
    <aura:attribute name="Changes" type="String"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="DisclaimerValue" type="Boolean" default="false"/>
    <aura:attribute name="ButtonDisabled" type="Boolean" default="true"/>
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
	<aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes', 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>

    <div style="width:400px;">
    <div class="slds-p-around_medium slds-p-bottom_medium" >
        
        <div class="slds-form slds-form_stacked">
			<lightning:select name="selectItem" label="How's the proof look?:" value="{!v.proofSelection}" class="slds-p-top_small"  >
        		<option value="-Select One-">-Select One-</option>
        		<option value="I approve my proof. Please proceed to print!">I approve my proof. Please proceed to print!</option>
        		<option value="I would like changes made to my proof.">I would like changes made to my proof.</option>
        	</lightning:select>           
            
    		<!-- If proof is not approved, also ask customer for changes. -->
        	<aura:if isTrue="{!v.proofSelection == 'I would like changes made to my proof.'}">
       			
					<div class="slds-form-element">
                	<lightning:textarea name="ChangesText" value="{!v.Changes}" label="Tell us what you'd like changed:" class="slds-p-top_small"/>
					<div class="slds-p-top_small"></div>
					<lightning:radioGroup aura:id="UploadFiles" name="UploadFiles"
                     label="Would you like to upload new content? (logos, images, etc)"
					options="{! v.radioOptions }" value="{! v.UploadFiles }" />
					<div class="slds-p-top_small"></div>
					</div>
                
                <!-- If customer clicks yes to upload files show the file upload iframe. -->
            	<aura:if isTrue="{! v.UploadFiles }" >      
            		<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            	</aura:if>
       		</aura:if>
            

          <div class="slds-p-top_small"></div>
        	<!-- If proof is  approved, askes customer for check box. -->
			<aura:if isTrue="{!v.proofSelection == 'I approve my proof. Please proceed to print!'}">
                       
        			<lightning:input aura:id="DisclaimerCheckBox" type="checkbox"
					label="I have proofread my artwork and am aware that Taradel is not responsible 
                    for any graphic, text, pricing, color variation or format issues after I submit 
                    the approval for print." 
                    name="DisclaimerCheckBox" value="DisclaimerCheckBox" onchange="{!c.handleCheck}" />
            </aura:if>  
          </div>
       <div class="slds-p-top_small"></div>    
       <lightning:button label="Finish and Save" aura:id="Finish_and_Save" 
       variant="neutral" onclick="{!c.handleChange}" disabled="{! v.ButtonDisabled}"/>
		<div class="slds-p-top_small"></div>
      <ui:outputText value="{!'Discalimer Value: ' + v.DisclaimerValue}" />
        <div class="slds-p-top_small"></div>
      <ui:outputText value="{!'ButtonDisabled Value: ' + v.ButtonDisabled}" />

    </div>
    </div>    
</aura:component>

Controller
({
   handleChange : function(component, event, helper) {
      // When an option is selected, navigate to the next screen
      var response = event.getSource().getLocalId();
      component.set("v.value", response);
      var navigate = component.get("v.navigateFlow");
      navigate("NEXT");
   },

    handleCheck : function(component, event, helper) {
        var isChecked = component.find("DisclaimerCheckBox").get("v.checked");
        component.set("v.DisclaimerValue", isChecked);
		      
		var disabled;
        	var boxvalue = component.find("DisclaimerCheckBox").get("v.checked");
        	if (boxvalue = true){
            	disabled = false;
        	} else {
            	boxvalue = true;
        	}
        	component.set("v.ButtonDisabled", disabled);
    }
 })

 

Hey guys, 

I send an email to external customers with a link to view a visualforce page that contains a flow. That URL passes some information to the flow. Lately this URL is getting broken buy some kind of email extension that one of our customers is using. Is there any way on my end to avoid this? Below is the error they are getting when loading the page . If you look you can see the URL is changing. (I've blured some secert stuff but you get the idea) Also below is the VF page code. 

Example Error:
User-added image

 

Example of a correct URL

http://eddmsite.force.com/QuestionnaireFlowLighting?DesignQuestionnaireID={IDofRecord}

 

apex:page showHeader="false">
<apex:image id="Topheader" value="Top banner" width="1903" height="141"/>
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div id="flowContainer" />
         <style>
textarea {
width: 70%;
height: 150px;
}
</style>
         <script>
            $Lightning.use("c:lightningOutApp", function() {
               $Lightning.createComponent("lightning:flow", {},
                  "flowContainer",
                  function (component) {
                     // Sets a value for the textVar input variable.
                     var inputVariables = [
                        {
                           name : 'DesignQuestionnaireID',
                           type : 'String',
                           value : "{!$CurrentPage.parameters.DesignQuestionnaireID}"
                        }
                     ];
                     // Starts an interview in the flowContainer div, and 
                     // initializes the textVar variable.
                     component.startFlow("Design_Questionnaire", inputVariables);
                  }
               );
            });
         </script>
      </body>
   </html>
   <apex:image id="Bottom banner" width="1903" height="141"/>
</apex:page>
Hey guys, 

I need to refresh an iFrame on when a user clicks a button. What's the best way to do that? I tried the solution shown here, which is neat, but for my purpose that appended "time" breaks my page. The page is a part of a managed package so I can't change it. Let me know if there is another way to do this.

Here is my code currently 

Cmp
<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="UploadFiles" type="Boolean" default="true"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="UploadWarning" type="String" />
    <aura:attribute name="time" type="String" />
    
    	<aura:if isTrue="{! v.UploadFiles }" >
                <ui:outputText class="warning" value="{!v.UploadWarning}" />
                <div class="slds-p-top_small"></div>
            	<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID + 't=' + v.time}" height="350px" 
                width="350px" frameborder="0" class="slds-p-bottom_small"/>
            <ui:button press="{!c.myAction}">Upload another file</ui:button><br/><!--Ifraim should be reloaded on the press of this button-->
            </aura:if>
</aura:component>

Controller
({
    myAction : function(component, event, helper) {

                 var d = new Date();
                 var n = d.getTime();   
				component.set("v.time", n );   
           
    }
})


 

Hey guys, 


Any idea why my visual flow is truncating the rich text label I have on my long text input field? I can't seem to stop it from happing. How can I fix this? 

 

Looks good in the flow builder: 
User-added image

 

But not when ran: 

User-added image

 

Hey guys, 

I have another weird one. I'm trying to change the font size of a lightning:radioGroup. So I created a class, and added the class to my Radio Group. It picks the change to "bold" but the font size doesn't change. Instead the spacing between the buttons change. What am I missing? 

SN: Went I apply this class to a paragraph element it works as intended. it only doesn't work on the lightning:radioGroup. 


Comp

<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes' , 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>
                <div class="test"><p>This is top level Paragraph elements</p></div>
			<lightning:radioGroup class="test" aura:id="UploadFiles" 
                        name="UploadFiles" 
                        label="Click here to upload any logos, pictures, or other files you would 
                        like incorporated in your design:" 
			options="{! v.radioOptions }" value="{! v.UploadFiles }" />

                <div class="slds-p-top_small"></div>
            

                
            <!-- If customer clicks yes to upload files show the file upload iframe. -->
            <aura:if isTrue="{! v.UploadFiles }" >      
            	<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" 
                width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            </aura:if>
</aura:component>
 

CSS class

.THIS.test{
font-size:20pt;
font-weight: bold;
}

 

Result with CCS applied

User-added image

Hey guys,

I'm new to Lightning components and everything is working perfectly except the checkbox. For some reason the checkbox below doesn't update the attribute to "True" when it's checked. Seeing as the Radio Group and Select fields work just fine I'm not really sure what I'm doing wrong and would love your help. Thanks!
 
<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="proofSelection" type="String"/>
    <aura:attribute name="Changes" type="String"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="DisclaimerValue" type="Boolean" default="false"/>
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
	<aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes', 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>

    <div style="width:400px;">
    <div class="slds-p-around_medium slds-p-bottom_medium" >
        <div class="slds-form slds-form_stacked">
			<lightning:select name="selectItem" label="How's the proof look?:" value="{!v.proofSelection}" class="slds-p-top_small"  >
        		<option value="-Select One-">-Select One-</option>
        		<option value="I approve my proof. Please proceed to print!">I approve my proof. Please proceed to   print!</option>
        		<option value="I would like changes made to my proof.">I would like changes made to my proof.</option>
        	</lightning:select>
            
            
    		<!-- If proof is not approved, also ask customer for changes. -->
        	<aura:if isTrue="{!v.proofSelection == 'I would like changes made to my proof.'}">
       			
                <div class="slds-form-element">
                	<lightning:textarea name="ChangesText" value="{!v.Changes}" label="Tell us what you'd like changed:" class="slds-p-top_small"/>
                
                <div class="slds-p-top_small"></div>
				<lightning:radioGroup aura:id="UploadFiles" name="UploadFiles"
      			   label="Would you like to upload new content? (logos, images, etc)"
					options="{! v.radioOptions }" value="{! v.UploadFiles }" />
                <div class="slds-p-top_small"></div>
                </div>
       		</aura:if>
            
            <aura:if isTrue="{! v.UploadFiles }" >      
            <iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            </aura:if>
          
        	<!-- If proof is  approved, askes customer for check box. -->
			<aura:if isTrue="{!v.proofSelection == 'I approve my proof. Please proceed to print!'}">
                
            <lightning:input type="checkbox" name="ProofDisclaimer" 
             label="I have proofread my artwork and am aware that Taradel is not responsible 
                       for any graphic, text, pricing, color variation or format issues after I 
                       submit the approval for print." value="{!v.DisclaimerValue}" aura:id="ProofDisclaimer" class="slds-p-vertical_small" Checked="true" />
    		</aura:if>  
          </div>
       <div class="slds-p-top_small"></div>    
       <lightning:button label="Finish and Save" aura:id="Finish_and_Save" 
       variant="neutral" onclick="{!c.handleChange}" />
        

    </div>
    </div>    
</aura:component>

 
Hi,
I am trying to trigger an apex class on incomming message from fb messenger. I did find ConversationEntry Object that contains messages but I am not able to write triggers or push topics using this object as it says not supported. I am not able to find a way to recieve an event for every new message from fb messenger. Can someone pls guide me on how to achieve this.

Thanks
Hey guys, 

How can I hide the scroll bar in on and Iframe in a lightning cmp? Here is what Ive tried.

Cmp
<aura:component access="global" implements="lightning:availableForFlowScreens">
<iframe src="{!v.iFrameURL}" height="{!v.iFrameheight+'px'}" width="{!v.iFramewidth+'px'} "frameborder="0" class="over"/>                                                                                                                             
</aura:component>


CSS

.THIS.over {
    overflow-y: hidden;
    overflow-x: hidden;

}

Hey guys I have an issue I'm hoping you can help with. I'm a little new to Apex but figuring it out (I think). I have a really awesome unmanaged package that assigns leads/cases (link) and it works great on the lead but I wanted to use it on a custom object. So I thought now problem, I'll just add a trigger for the custom object and modify the other bits to work. 

So I built the trigger and it works great and at the end it calls an apex class which should finish off what the trigger started. But the weird thing is the apex class returns nothing in to SOQL query. However when the trigger is hit again (to assign another record) the SOQL query runs and finds the previous record. It's like the apex class SOQL query is running before the trigger finishes updating. The lead assignment works in the same way and has no issues.

My questions are: 

1. Why is this happening? 

2. Why did the orginal developer build it this way? Why have the seperate APEX class? Couldn't it all be done within the trigger? Just wondering for the sake of learning. 


Here is the orginal trigger: 

 

trigger FireLeadDistribution on Lead (before insert, before update) {
    
Set<String> setLeadcriteria= new Set<String>();    
    for ( Lead objLead : Trigger.new)  {        
        setLeadcriteria.add(objLead.distributionValue__c);
    }

    Map<Id, Receiver__c>updtReceivers = new Map<Id,Receiver__c>();
    Map<Id, Distributor__c>updtDistributors = new Map<Id,Distributor__c>();
    List<Id> leadIds = new LIst<Id>();
  
    Receiver__c[] receiver = [SELECT name,distributor__r.distributioncount__c,distributorstatus__c, id,relateduser__c ,
    distributionValue__c, recordsreceived__c,LastDistributionTime__c,distributor__r.sumofquotas__c,
    first__c,last__c,position__c FROM Receiver__c WHERE distributionValue__c =: setleadcriteria 
    AND Status__c = 'Active' AND UserStatus__c = 'OK' AND DistributorStatus__c = 'Active' AND distributorObject__c = 'Lead'
    ORDER BY distributionValue__c, position__c LIMIT 1000];
        
    for(Lead lid : trigger.new){
       
        if(lid.distributionValue__c != null && lid.isDistributed__c == false && lid.isconverted == false ){
            for(integer i=0;i< receiver.size();i++){ // loop through receivers
                if(lid.distributionValue__c == receiver[i].distributionValue__c){
                 
                    Integer leadCount = integer.valueof(receiver[i].distributor__r.distributioncount__c);                  
                    Integer quotasSum = integer.valueof(receiver[i].distributor__r.sumofquotas__c);      
                    Integer remainder = math.mod(leadCount , quotasSum );
                    
                   
                   if(remainder >= receiver[i].first__c && remainder <= receiver[i].last__c ){ 
                                        
                       receiver[i].recordsreceived__c = receiver[i].recordsreceived__c+1;
                       receiver[i].distributor__r.distributioncount__c = receiver[i].distributor__r.distributioncount__c+1;

                       receiver[i].LastDistributionTime__c = system.now();

                       lid.receiverID__c = receiver[i].relateduser__c ;
                       lid.isDistributed__c = true ;
                       leadids.add(lid.id);
                                              
                       updtReceivers.put(receiver[i].id, receiver[i]);
                       updtDistributors.put(receiver[i].Distributor__c,receiver[i].distributor__r); 
                       
                       break;
                   }
                }
                
                              
            }//end for "i"
        }    
    }// end for "lid"
    if(updtReceivers.size()>0){
        update updtReceivers.values();
    }
    if(updtDistributors.size()>0){
        update updtDistributors.values();
    }
    if(leadids.size()>0){
        DistributorsAssignment.LeadAssignment(leadids);  
    }   
}


Here is my trigger:

trigger FireOrderItemDistributionPreflight on Order_Item__c (before insert, before update) {

Set<String> setOrderItemcriteria= new Set<String>();    
    for ( Order_Item__c objOrderItem : Trigger.new)  {        
        setOrderItemcriteria.add(objOrderItem.PreflightDistributionValue__c);
    }

    Map<Id, Receiver__c>updtReceivers = new Map<Id,Receiver__c>();
    Map<Id, Distributor__c>updtDistributors = new Map<Id,Distributor__c>();
    List<Id> itemids = new List<Id>();
  
    Receiver__c[] receiver = [SELECT name,distributor__r.distributioncount__c,distributorstatus__c, id,relateduser__c ,
    distributionValue__c, recordsreceived__c,LastDistributionTime__c,distributor__r.sumofquotas__c,
    first__c,last__c,position__c FROM Receiver__c WHERE DistributionValue__c =: setOrderItemcriteria
    AND Status__c = 'Active' AND UserStatus__c = 'OK' AND DistributorStatus__c = 'Active' AND distributorObject__c = 'Order Item'
    ORDER BY distributionValue__c, position__c LIMIT 1000];
        
    for(Order_Item__c oid : trigger.new){
       
        if(oid.PreflightDistributionValue__c != null && oid.isPreflightDistributed__c == false ){
            for(integer i=0;i< receiver.size();i++){ // loop through receivers
                if(oid.PreflightDistributionValue__c == receiver[i].distributionValue__c){
                 
                    Integer OrderItemCount = integer.valueof(receiver[i].distributor__r.distributioncount__c);                  
                    Integer quotasSum = integer.valueof(receiver[i].distributor__r.sumofquotas__c);      
                    Integer remainder = math.mod(OrderItemCount , quotasSum );
                    
                   
                   if(remainder >= receiver[i].first__c && remainder <= receiver[i].last__c ){ 
                                        
                       receiver[i].recordsreceived__c = receiver[i].recordsreceived__c+1;
                       receiver[i].distributor__r.distributioncount__c = receiver[i].distributor__r.distributioncount__c+1;

                       receiver[i].LastDistributionTime__c = system.now();

                       oid.PreflightReceiverID__c = receiver[i].relateduser__c ;
                       oid.isPreflightDistributed__c = true ;
                       itemids.add(oid.id);
                       
                       updtReceivers.put(receiver[i].id, receiver[i]);
                       updtDistributors.put(receiver[i].Distributor__c,receiver[i].distributor__r); 
                       
                       break;
                   }
                }
                
                              
            }//end for "i"
        }    
    }// end for "Oid"
    if(updtReceivers.size()>0){
        update updtReceivers.values();
    }
    if(updtDistributors.size()>0){
        update updtDistributors.values();
    }
    if(itemids.size()>0){
        DistributorsAssignment.ItemPreflightAssignment(itemids);  
    }   
}

Here is the class they both trigger:

public with sharing class DistributorsAssignment {
    @future 
    public static void LeadAssignment(list<id> leadids ) {
    
        List<Lead> assignWithoutNotif = new List<Lead>();
        
        Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;    
     
        for(Lead lidz : [SELECT Id,ownerid, receiverID__c FROM Lead WHERE isdistributed__c = true AND receiverID__c != NULL]){

                lidz.OwnerId = lidz.receiverID__c ; 
                lidz.receiverID__c = NULL;
                                     
                lidz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(lidz);
            
        }  
       if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
        
    }
    public static void CaseAssignment(list<id> Caseids ) {
    
        List<Case> assignWithoutNotif = new List<Case>();

        
        Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;    
      
        for(Case kasz : [SELECT Id,ownerid, receiverID__c FROM Case WHERE isdistributed__c = true AND receiverID__c != NULL]){

                kasz.OwnerId = kasz.receiverID__c ; 
                kasz.receiverID__c = '';

                kasz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(kasz);
           
        }  
        if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
       
    }
	public static void ItemPreflightAssignment(list<id> itemIds ) {
    
        List<Order_Item__c> assignWithoutNotif = new List<Order_Item__c>();
            
		Database.DMLOptions dloNoNotif = new Database.DMLOptions();           
        dloNoNotif.EmailHeader.triggerUserEmail = false;    
        dloNoNotif.EmailHeader.triggerOtherEmail = false;
     
        for(Order_Item__c oidz : [SELECT Id,Preflighter__c, PreflightReceiverID__c FROM Order_Item__c WHERE isPreflightDistributed__c = true AND PreflightReceiverID__c != NULL]){

                oidz.Comments__c = 'test' ;
            	oidz.Preflighter__c = oidz.PreflightReceiverID__c ;
                oidz.PreflightReceiverID__c = NULL;
				
				oidz.setOptions(dloNoNotif); 
                assignWithoutNotif.add(oidz);
            
        }
		if(assignWithoutNotif.size()>0){          
            database.update(assignWithoutNotif ,dloNoNotif);
        }
        
    }
    
	public static void ItemSenderAssignment(list<id> Itemids ) {
    
        List<Order_Item__c> assignWithoutNotif = new List<Order_Item__c>();

     
        for(Order_Item__c Oidz : [SELECT Id,Sender__c, SenderReceiverID__c FROM Order_Item__c WHERE isSenderDistributed__c = true AND SenderReceiverID__c != NULL]){

                Oidz.Sender__c = Oidz.SenderReceiverID__c ; 
                Oidz.SenderReceiverID__c = NULL;

            
        }
        
    }
    
}

Hey guys,

Here is a fun one, I am working on disabling a button unless a checkbox disclaimer is checked. I wrote a little controller that should check the checkbox value and depending on whether it's true or false, update the disabled boolean to the inverse. It works on the first change when I check the box the diabled flag goes to false. However when I uncheck the box it doesn't update that boolean. What am I doing wrong? Thanks!

Examples screenshots
This is correct. 

User-added image
This is correct. 
User-added image
This is not, the button value should be true
User-added image

Cmp code 
 

<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="proofSelection" type="String"/>
    <aura:attribute name="Changes" type="String"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="DisclaimerValue" type="Boolean" default="false"/>
    <aura:attribute name="ButtonDisabled" type="Boolean" default="true"/>
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
	<aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes', 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>

    <div style="width:400px;">
    <div class="slds-p-around_medium slds-p-bottom_medium" >
        
        <div class="slds-form slds-form_stacked">
			<lightning:select name="selectItem" label="How's the proof look?:" value="{!v.proofSelection}" class="slds-p-top_small"  >
        		<option value="-Select One-">-Select One-</option>
        		<option value="I approve my proof. Please proceed to print!">I approve my proof. Please proceed to print!</option>
        		<option value="I would like changes made to my proof.">I would like changes made to my proof.</option>
        	</lightning:select>           
            
    		<!-- If proof is not approved, also ask customer for changes. -->
        	<aura:if isTrue="{!v.proofSelection == 'I would like changes made to my proof.'}">
       			
					<div class="slds-form-element">
                	<lightning:textarea name="ChangesText" value="{!v.Changes}" label="Tell us what you'd like changed:" class="slds-p-top_small"/>
					<div class="slds-p-top_small"></div>
					<lightning:radioGroup aura:id="UploadFiles" name="UploadFiles"
                     label="Would you like to upload new content? (logos, images, etc)"
					options="{! v.radioOptions }" value="{! v.UploadFiles }" />
					<div class="slds-p-top_small"></div>
					</div>
                
                <!-- If customer clicks yes to upload files show the file upload iframe. -->
            	<aura:if isTrue="{! v.UploadFiles }" >      
            		<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            	</aura:if>
       		</aura:if>
            

          <div class="slds-p-top_small"></div>
        	<!-- If proof is  approved, askes customer for check box. -->
			<aura:if isTrue="{!v.proofSelection == 'I approve my proof. Please proceed to print!'}">
                       
        			<lightning:input aura:id="DisclaimerCheckBox" type="checkbox"
					label="I have proofread my artwork and am aware that Taradel is not responsible 
                    for any graphic, text, pricing, color variation or format issues after I submit 
                    the approval for print." 
                    name="DisclaimerCheckBox" value="DisclaimerCheckBox" onchange="{!c.handleCheck}" />
            </aura:if>  
          </div>
       <div class="slds-p-top_small"></div>    
       <lightning:button label="Finish and Save" aura:id="Finish_and_Save" 
       variant="neutral" onclick="{!c.handleChange}" disabled="{! v.ButtonDisabled}"/>
		<div class="slds-p-top_small"></div>
      <ui:outputText value="{!'Discalimer Value: ' + v.DisclaimerValue}" />
        <div class="slds-p-top_small"></div>
      <ui:outputText value="{!'ButtonDisabled Value: ' + v.ButtonDisabled}" />

    </div>
    </div>    
</aura:component>

Controller
({
   handleChange : function(component, event, helper) {
      // When an option is selected, navigate to the next screen
      var response = event.getSource().getLocalId();
      component.set("v.value", response);
      var navigate = component.get("v.navigateFlow");
      navigate("NEXT");
   },

    handleCheck : function(component, event, helper) {
        var isChecked = component.find("DisclaimerCheckBox").get("v.checked");
        component.set("v.DisclaimerValue", isChecked);
		      
		var disabled;
        	var boxvalue = component.find("DisclaimerCheckBox").get("v.checked");
        	if (boxvalue = true){
            	disabled = false;
        	} else {
            	boxvalue = true;
        	}
        	component.set("v.ButtonDisabled", disabled);
    }
 })

 

Hey guys, 

I send an email to external customers with a link to view a visualforce page that contains a flow. That URL passes some information to the flow. Lately this URL is getting broken buy some kind of email extension that one of our customers is using. Is there any way on my end to avoid this? Below is the error they are getting when loading the page . If you look you can see the URL is changing. (I've blured some secert stuff but you get the idea) Also below is the VF page code. 

Example Error:
User-added image

 

Example of a correct URL

http://eddmsite.force.com/QuestionnaireFlowLighting?DesignQuestionnaireID={IDofRecord}

 

apex:page showHeader="false">
<apex:image id="Topheader" value="Top banner" width="1903" height="141"/>
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div id="flowContainer" />
         <style>
textarea {
width: 70%;
height: 150px;
}
</style>
         <script>
            $Lightning.use("c:lightningOutApp", function() {
               $Lightning.createComponent("lightning:flow", {},
                  "flowContainer",
                  function (component) {
                     // Sets a value for the textVar input variable.
                     var inputVariables = [
                        {
                           name : 'DesignQuestionnaireID',
                           type : 'String',
                           value : "{!$CurrentPage.parameters.DesignQuestionnaireID}"
                        }
                     ];
                     // Starts an interview in the flowContainer div, and 
                     // initializes the textVar variable.
                     component.startFlow("Design_Questionnaire", inputVariables);
                  }
               );
            });
         </script>
      </body>
   </html>
   <apex:image id="Bottom banner" width="1903" height="141"/>
</apex:page>
Hey guys, 

I need to refresh an iFrame on when a user clicks a button. What's the best way to do that? I tried the solution shown here, which is neat, but for my purpose that appended "time" breaks my page. The page is a part of a managed package so I can't change it. Let me know if there is another way to do this.

Here is my code currently 

Cmp
<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="UploadFiles" type="Boolean" default="true"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="UploadWarning" type="String" />
    <aura:attribute name="time" type="String" />
    
    	<aura:if isTrue="{! v.UploadFiles }" >
                <ui:outputText class="warning" value="{!v.UploadWarning}" />
                <div class="slds-p-top_small"></div>
            	<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID + 't=' + v.time}" height="350px" 
                width="350px" frameborder="0" class="slds-p-bottom_small"/>
            <ui:button press="{!c.myAction}">Upload another file</ui:button><br/><!--Ifraim should be reloaded on the press of this button-->
            </aura:if>
</aura:component>

Controller
({
    myAction : function(component, event, helper) {

                 var d = new Date();
                 var n = d.getTime();   
				component.set("v.time", n );   
           
    }
})


 

Hey guys, 

I have another weird one. I'm trying to change the font size of a lightning:radioGroup. So I created a class, and added the class to my Radio Group. It picks the change to "bold" but the font size doesn't change. Instead the spacing between the buttons change. What am I missing? 

SN: Went I apply this class to a paragraph element it works as intended. it only doesn't work on the lightning:radioGroup. 


Comp

<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes' , 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>
                <div class="test"><p>This is top level Paragraph elements</p></div>
			<lightning:radioGroup class="test" aura:id="UploadFiles" 
                        name="UploadFiles" 
                        label="Click here to upload any logos, pictures, or other files you would 
                        like incorporated in your design:" 
			options="{! v.radioOptions }" value="{! v.UploadFiles }" />

                <div class="slds-p-top_small"></div>
            

                
            <!-- If customer clicks yes to upload files show the file upload iframe. -->
            <aura:if isTrue="{! v.UploadFiles }" >      
            	<iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" 
                width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            </aura:if>
</aura:component>
 

CSS class

.THIS.test{
font-size:20pt;
font-weight: bold;
}

 

Result with CCS applied

User-added image

Hey guys,

I'm new to Lightning components and everything is working perfectly except the checkbox. For some reason the checkbox below doesn't update the attribute to "True" when it's checked. Seeing as the Radio Group and Select fields work just fine I'm not really sure what I'm doing wrong and would love your help. Thanks!
 
<aura:component access="global" implements="lightning:availableForFlowScreens">
    <aura:attribute name="proofSelection" type="String"/>
    <aura:attribute name="Changes" type="String"/>
    <aura:attribute name="Encoded_ID" type="String" />
    <aura:attribute name="DisclaimerValue" type="Boolean" default="false"/>
    <aura:attribute name="UploadFiles" type="Boolean" default="false"/>
	<aura:attribute name="radioOptions" type="List" default="[
      {'label': 'Yes', 'value': 'true'},
      {'label': 'No', 'value': 'false'} ]"/>

    <div style="width:400px;">
    <div class="slds-p-around_medium slds-p-bottom_medium" >
        <div class="slds-form slds-form_stacked">
			<lightning:select name="selectItem" label="How's the proof look?:" value="{!v.proofSelection}" class="slds-p-top_small"  >
        		<option value="-Select One-">-Select One-</option>
        		<option value="I approve my proof. Please proceed to print!">I approve my proof. Please proceed to   print!</option>
        		<option value="I would like changes made to my proof.">I would like changes made to my proof.</option>
        	</lightning:select>
            
            
    		<!-- If proof is not approved, also ask customer for changes. -->
        	<aura:if isTrue="{!v.proofSelection == 'I would like changes made to my proof.'}">
       			
                <div class="slds-form-element">
                	<lightning:textarea name="ChangesText" value="{!v.Changes}" label="Tell us what you'd like changed:" class="slds-p-top_small"/>
                
                <div class="slds-p-top_small"></div>
				<lightning:radioGroup aura:id="UploadFiles" name="UploadFiles"
      			   label="Would you like to upload new content? (logos, images, etc)"
					options="{! v.radioOptions }" value="{! v.UploadFiles }" />
                <div class="slds-p-top_small"></div>
                </div>
       		</aura:if>
            
            <aura:if isTrue="{! v.UploadFiles }" >      
            <iframe src="{!'/TVA_CFB__RequestFile?'+v.Encoded_ID}" height="325px" width="325px" frameborder="0" class="slds-p-bottom_small"/>                                                                                                                             
            </aura:if>
          
        	<!-- If proof is  approved, askes customer for check box. -->
			<aura:if isTrue="{!v.proofSelection == 'I approve my proof. Please proceed to print!'}">
                
            <lightning:input type="checkbox" name="ProofDisclaimer" 
             label="I have proofread my artwork and am aware that Taradel is not responsible 
                       for any graphic, text, pricing, color variation or format issues after I 
                       submit the approval for print." value="{!v.DisclaimerValue}" aura:id="ProofDisclaimer" class="slds-p-vertical_small" Checked="true" />
    		</aura:if>  
          </div>
       <div class="slds-p-top_small"></div>    
       <lightning:button label="Finish and Save" aura:id="Finish_and_Save" 
       variant="neutral" onclick="{!c.handleChange}" />
        

    </div>
    </div>    
</aura:component>

 
Im using ui:inputDate  to display date filed ,
Is there any solution to disable the past dates in date picker?