• Sanjay Bhati 95
  • NEWBIE
  • 105 Points
  • Member since 2017
  • Certified Salesforce Developer


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 45
    Replies
I have test classes that have been built using the @IsTest(SeeAllData=true) however, to my understanding it's not the best practice. Do I need to rewrite new test.classes using @IsTest(SeeAllData=false) or can I just replace the original code and then redeploying via a force.com tool?
<aura:component controller="VerificationFilesController" Implements="flexipage:availableForRecordHome,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="force:refreshView" action="{!c.doInit}" />
    <aura:attribute name="recordError" type="String" access="private"/>
<aura:attribute name="isMultiSelectOpen" type="boolean" />
    <aura:attribute name="options" type="List" default="[]"/>
    <aura:attribute name="values" type="List" default="[]"/>
<lightning:button variant="brand" label="Request for Additional Documents" title="Request for Additional Documents" onclick="{!c.openMultiSelectModel}"/>
    <aura:if isTrue="{!v.isMultiSelectOpen}">
        <!--###### MODAL BOX Start From Here ######--> 
        <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
            <div class="slds-modal__container">
                <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
                <div class="slds-modal__header">
                    <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeReviewer}">
                        X
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="header99" class="slds-text-heading--medium">Review Document</h2>
                </div>
                <!--###### MODAL BOX BODY Part Start From Here ######-->
                <div class="slds-modal__content slds-p-around--medium  slds-is-relative slds-scrollable">
                    <aura:if isTrue="{!v.showSpinner}">
                        <div class="demo-only" style="height:6rem;">
                            <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                                <span class="slds-assistive-text">Loading</span>
                                <div class="slds-spinner__dot-a"></div>
                                <div class="slds-spinner__dot-b"></div>
                            </div>
                        </div>
                        <aura:set attribute="else">
                            <div class="slds-form-element slds-p-around--medium">

        <lightning:dualListbox aura:id="selectOptions"
                                               name="multipleOptions"  
                                               label= "Select Options" 
                                               sourceLabel="Available Options" 
                                               selectedLabel="Selected Options" 
                                               options="{!v.options}" 
                                               value="{!v.values}" 
                                               onchange="{!c.handleChange}"/>     
 </div>
                        </aura:set>
                    </aura:if>
                </div>
                    <button class="slds-button slds-button--neutral" onclick="{!c.closeReviewer}" >Cancel</button>
                </div>
            </div>
        </div>
        <div class="slds-backdrop slds-backdrop--open"></div>
        <!--###### MODAL BOX Part END Here ######-->
        

    </aura:if>
({
    doInit: function(component, event, helper) {         
        var action1 = component.get('c.getTypeWiseDocuments');
        //var typewisedocument = component.find("selectOptions");
        action1.setCallback(this, function(response1) {
            var state = response1.getState();
            if (component.isValid() && state == 'SUCCESS') { 
            var documents = response1.getReturnValue();
            var options = [];
            documents.forEach(function(document)  { 
                    console.log(document);
                    options.push({ value: document.Document_Name__c, label: document.Document_Name__c});
                });
                component.set("v.options", options);
                component.get("v.values");
                alert(JSON.stringify(component.get("v.options")));
            } else {
                console.log('Failed with state: ' + state);
            }
         });
        $A.enqueueAction(action1);
        
    },
handleChange: function (cmp, event) {
        // This will contain an array of the "value" attribute of the selected options
      
         var selectedOptionValue =event.getParam("value");
        alert("Option selected with value: '" + selectedOptionValue.toString() + "'");         
    },
     openMultiSelectModel: function(component, event, helper) {
        // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
        component.set("v.isMultiSelectOpen", true);
        alert(component.get("v.isMultiSelectOpen"));
    },
    closeMultiSelectModel : function(component, event, helper) {
        component.set("v.isMultiSelectOpen", false);
    }
})
public class VerificationFilesController {
@AuraEnabled
    public static List<TypeWiseDocument__c> getTypeWiseDocuments(){
        system.debug('getTypeWiseDocuments Controller');
        List<TypeWiseDocument__c> twList = [SELECT  ID,Document_Name__c FROM TypeWiseDocument__c where DocumentType__c = 'Additional'];
        return twList;        
    }
}



 
I have created a customer object called Internal Team Members in which users will be assigned a role for a project. I need the owners of these records to match the user identified and assigned a role within the object. 

Any help would be greatly appreciated. Thank you in advance. 
I have test classes that have been built using the @IsTest(SeeAllData=true) however, to my understanding it's not the best practice. Do I need to rewrite new test.classes using @IsTest(SeeAllData=false) or can I just replace the original code and then redeploying via a force.com tool?
SOQL to fetch records which has been created over 2 years and no update on those records.
I have created an onclick event on the cancel button in my visualforce page and it works as expected. I want to change the wording for OK and Cancel button to Yes, Proceed and No, Stay.
Is it possible. if yes, can someone suggest me how or share sample code
 
<apex:commandButton value="{!$Label.Cancel}" action="{!Cancel}" onclick="return confirm('{!$Label.Proceed_with_Cancellation}');" styleclass="slds-button slds-button_brand" style="width:150px;"/>

User-added image
 
  • September 11, 2019
  • Like
  • 0
How to display validation error in same page without redirecting to new page using trigger on click of delete button?
I'm new to Lightning Design System and am trying to find concrete examples of how to apply standard design tokens from this guide: https://www.lightningdesignsystem.com/design-tokens/#category-font-size

I have a Lightning Component, but it's unclear how to reference them. 

Would appreciate any help! 

I am using service console App.I have a Detail-record page, where you can see (record page, activity timeline page and related list) and on header of the page there is new support case button to create a new case record.
I have an activity timeline (lightning component) that display a case record, event, record view details. Whenever detail page is opened, it automatically retrieve the record ID of that detail page and display those records(CASE,EVENT,RECORD VIEWS DETAILS) in activity Timeline component.
so far whenever we create a case record, I have to manually refresh the page then it will display the new case record in activity timeline page.
Now my requirement is, Instead of doing manual refresh, I want it to auto refresh the activity timeline(lightning component) to view the case record by using NEW SUPPORT CASE button.
ActivityTimeline is a lightning component, where I need to write a code for auto refresh process.
Please let me know if you need more information
Please help me out of this.
Many thanks in advance
 
I am trying to check if checkbox is selected by user or not . but I am getting error while fetching the checkbox component. I am using the code like :
Test.cmp code : On load I need to check if value of innerMap.Value[0] is true or not.then disable the checkboc if already true.

<aura:if isTrue="{!innerMap.Value[0]}">
           
            <ui:inputCheckbox aura:id="checkbox1" name="checkbox-89"  disabled="true" value = ""/>
              <label class="slds-checkbox__label" for="checkbox">
                <span class="slds-checkbox_faux"></span>
                <span class="slds-form-element__label">8AM</span>
              </label>
          <aura:set attribute="else">
            <ui:inputCheckbox aura:id="checkbox1" name="checkbox-89" value = "" />
                  <label class="slds-checkbox__label" for="checkbox">
                    <span class="slds-checkbox_faux"></span>
                    <span class="slds-form-element__label">   8AM    </span>
                  </label>
        </aura:set>
    </aura:if>

<td><lightning:button label="Submit" 
                                          class="slds-m-top--medium"
                                          variant="brand"
                                          onclick="{!c.callConfirmation}"/> </td>

TestController.js 

callConfirmation: function(component, event, helper) {
 var checkbox1 = component.find("checkbox1").get("v.value");
}
I am getting below error when I click on Submit Button.
This page has an error. You might just need to refresh it.
Action failed: c:AvailableUsers$controller$callConfirmation [component.find(...).get is not a function]
Failing descriptor: {c:AvailableUsers$controller$callConfirmation}

Can someone please help me ? what wrong I am doing? I try finding the solution but find that people have used same type of code.
 
Need small help on this
 
1)Account.Lob contains multiselect itest1
 
2)Account.Lob contains multiselect itest2
 
3)Account.Type equals field reference Account.Type
 
4)Account.Type does not equals  PP
 
5)Account.Type does not equals GP
 
Using ISNew how to add above criterias in Formula evaluation true critera in process builder decision box

Thanks 
 
I am using a function to concatenate as follows in my lightning controller class 

getCompValue : function(component, event, helper) {
     
     var compVal = component.find("comp_id").get("v.value");
     var compValStr = '\'' + compVal + '\'';
     component.set("v.componentName", compValStr);
        
   },

but on save the value is becoming 
 &#39;a2u180000003p27AAA&#39;
Do you have any resolution on the same how to concatenate
' + <<variable>> + ' to get the result as 'a2u180000003p27AAA' 
Hi Please help me above error is throwing when  i am trying to save class 

public class AddPrimaryContact implements Queueable {
    
    private Contact mainContact;
    private list<Schema.Account> accounts;
    
    public AddPrimaryContact (Contact c, String abbr) {
        this.mainContact = c;
        this.accounts = [Select Id, Name From Account Where BillingState = :abbr limit 200];
    }
    
    public void execute (QueueableContext context) {

        list<Contact> newContacts = new list<Contact>();                
        for (Account a :this.accounts) {
            Contact newContact = this.mainContact.Clone();
            newContact.AccountId = a.Id;
            newContacts.Add(newContact);
        }
        insert newContacts;
    }
}
  • March 05, 2019
  • Like
  • 0
User cannot upload consent file with large size.
The org file size limit is 6000 000 bytes(6MB).
When user try to upload file with size 3 - 5.7 MB (in allowed limit), the error is displayed  --> Received exception event aura:systemError from server
IF file within 2MB is uploaded, there is no error. This seems to be happening since Spring 19 release.
Any ideas why?
<aura:component controller="VerificationFilesController" Implements="flexipage:availableForRecordHome,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="force:refreshView" action="{!c.doInit}" />
    <aura:attribute name="recordError" type="String" access="private"/>
<aura:attribute name="isMultiSelectOpen" type="boolean" />
    <aura:attribute name="options" type="List" default="[]"/>
    <aura:attribute name="values" type="List" default="[]"/>
<lightning:button variant="brand" label="Request for Additional Documents" title="Request for Additional Documents" onclick="{!c.openMultiSelectModel}"/>
    <aura:if isTrue="{!v.isMultiSelectOpen}">
        <!--###### MODAL BOX Start From Here ######--> 
        <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
            <div class="slds-modal__container">
                <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
                <div class="slds-modal__header">
                    <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeReviewer}">
                        X
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="header99" class="slds-text-heading--medium">Review Document</h2>
                </div>
                <!--###### MODAL BOX BODY Part Start From Here ######-->
                <div class="slds-modal__content slds-p-around--medium  slds-is-relative slds-scrollable">
                    <aura:if isTrue="{!v.showSpinner}">
                        <div class="demo-only" style="height:6rem;">
                            <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                                <span class="slds-assistive-text">Loading</span>
                                <div class="slds-spinner__dot-a"></div>
                                <div class="slds-spinner__dot-b"></div>
                            </div>
                        </div>
                        <aura:set attribute="else">
                            <div class="slds-form-element slds-p-around--medium">

        <lightning:dualListbox aura:id="selectOptions"
                                               name="multipleOptions"  
                                               label= "Select Options" 
                                               sourceLabel="Available Options" 
                                               selectedLabel="Selected Options" 
                                               options="{!v.options}" 
                                               value="{!v.values}" 
                                               onchange="{!c.handleChange}"/>     
 </div>
                        </aura:set>
                    </aura:if>
                </div>
                    <button class="slds-button slds-button--neutral" onclick="{!c.closeReviewer}" >Cancel</button>
                </div>
            </div>
        </div>
        <div class="slds-backdrop slds-backdrop--open"></div>
        <!--###### MODAL BOX Part END Here ######-->
        

    </aura:if>
({
    doInit: function(component, event, helper) {         
        var action1 = component.get('c.getTypeWiseDocuments');
        //var typewisedocument = component.find("selectOptions");
        action1.setCallback(this, function(response1) {
            var state = response1.getState();
            if (component.isValid() && state == 'SUCCESS') { 
            var documents = response1.getReturnValue();
            var options = [];
            documents.forEach(function(document)  { 
                    console.log(document);
                    options.push({ value: document.Document_Name__c, label: document.Document_Name__c});
                });
                component.set("v.options", options);
                component.get("v.values");
                alert(JSON.stringify(component.get("v.options")));
            } else {
                console.log('Failed with state: ' + state);
            }
         });
        $A.enqueueAction(action1);
        
    },
handleChange: function (cmp, event) {
        // This will contain an array of the "value" attribute of the selected options
      
         var selectedOptionValue =event.getParam("value");
        alert("Option selected with value: '" + selectedOptionValue.toString() + "'");         
    },
     openMultiSelectModel: function(component, event, helper) {
        // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
        component.set("v.isMultiSelectOpen", true);
        alert(component.get("v.isMultiSelectOpen"));
    },
    closeMultiSelectModel : function(component, event, helper) {
        component.set("v.isMultiSelectOpen", false);
    }
})
public class VerificationFilesController {
@AuraEnabled
    public static List<TypeWiseDocument__c> getTypeWiseDocuments(){
        system.debug('getTypeWiseDocuments Controller');
        List<TypeWiseDocument__c> twList = [SELECT  ID,Document_Name__c FROM TypeWiseDocument__c where DocumentType__c = 'Additional'];
        return twList;        
    }
}



 
I have created custom buttons which I would only make available based on the Contact.Type field value selected. Is it possible to create a custom component where I can group these buttons?
I see that there is a Console page template for Console: Pinned Header and Left Sidebar, but not one for Console: Pinned Header and Right Sidebar.  I was attempting to create my own component, but after much searching and reviewing of documentation, I haven't found anything on pinning columns/headers in a custom template component.   

Has anyone had any luck with this, or is there an example available anywhere that may have some documentation on how they accomplished this with their default console templates?  Thanks.
  • July 11, 2018
  • Like
  • 1
Hi there.  I am trying to use a simple Visualforce page as a lightning component, but unable to make it available in the Lightning App Builder.  I have added lightningStylesheets="true" to the <apex:page> tag and ticked off the box  "Add Available for Lightning Experience, Lightning Communities, and the mobile app". What am I doing wrong here? The VF page is a simple marquee that we intend to use as a news ticker across the top of the home page. Please help.