• Ankit Rathor
  • NEWBIE
  • 95 Points
  • Member since 2019

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 14
    Replies
I am creating a custom lightning component to create an Account record and am wanting to make the field 'Description' taller.  Images below will explain better what I am wanting to do.  I want the input section of the field to be taller like this:

User-added image
Instead of what I currently have:

User-added image
I have been googling trying to figure out how to do this and apparenlty am not entering the correct key words to find a solution. 

Here is the section of code for this portion of the screen:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Description" name="Description" value="{!v.AcctForm.Description}"/>       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Region" name="Region" value="{!v.AcctForm.Region__c }" />       
        </lightning:layoutItem>
    </lightning:layout>

Would greatly appreciate any help that can be provided!
Hello Folks,

I created a list that loads all attachments related to a custom object, but I need to download them and I am trying to create a link unsuccessfully, someone could help me.
Follow my code

 
AttachmentList.cmp
-------------------------------------------------------------------------------------------------------------




<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" controller="AttachmentListController"> 
    
     
      
     <aura:attribute name="recordId" type="Id"/>
     <aura:attribute name="files" type="List"/>
     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    
    
    
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
             <thead>
            <tr class="slds-line-height_reset">
              <th scope="col"><div class="slds-truncate" title="Name">Anexos</div></th>
              <th scope="col"><div class="slds-truncate" title="tipo">Tipo</div></th>

            </tr>
          </thead>
          
        
        <tbody>
           <aura:iteration items="{!v.files}" var="obj">
                <tr>
                    <th scope="row"> <a href="{!'/portal/servlet.shepherd/version/download/'+obj.Id}">{!obj.Title}</a>   </th> 

                    <!-- <th scope="row"> <a href="{!'/portal/servlet/servlet.FileDownload?file='+obj.Id}" >{!obj.Title}</a>   </th> -->
                  
                  <th scope="row"><div class="slds-truncate" title="Type">{!obj.FileType}</div></th>
                    
                   
                   
                    <td>
                    
                        
	        </td>
                </tr>
            </aura:iteration>
          </tbody>
        </table>
    
    
    
    
	
</aura:component>

AttachmentListController.js
------------------------------------------------------------------------------------------------------------



({
	
    

    doInit : function(component, event, helper) {
			  $A.enqueueAction(component.get('c.getList'));
	},
    
    
    doInit : function(component, event, helper) { 
        $A.enqueueAction(component.get('c.getList')); 
    }, 
    
    
    getList: function(component, event, helper) { 
        var action = component.get("c.getContentDocs"); 
        action.setParams( { 
            arecordId : component.get('v.recordId')
        }); 
        action.setCallback(this, function(actionResult) {
            component.set('v.files',actionResult.getReturnValue()); 
        }); 
        $A.enqueueAction(action); 
    },
    
    
    
    
    
    

    
    
})

AttachmentListController.apxc
---------------------------------------------------------------------------------------------------------



public class AttachmentListController {
    
  @AuraEnabled
    public static List<ContentDocument> getContentDocs(Id arecordId) {
        List<ContentDocumentLink> CDLs = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :arecordId];
        if (CDLs.size() < 1) {
            return new List<ContentDocument>();
        }
        List<Id> CDIdList = new List<Id> (); 
        for (ContentDocumentLink nextCDL : CDLs) { 
            CDIdList.add(nextCDL.ContentDocumentId); 
        } 
        List<ContentDocument> entries = [SELECT Id, Title, FileType FROM ContentDocument WHERE Id IN :CDIdList]; 
        return entries;
    }
     
    
    

}

 
Hi,
I have to navigate LWC to Aura component, so in this scenario how to pass recordId LWC to aura component
can any one help me on this.
I'm trying to figure out how to add X amount of days to a date through the lightning component controller. Here is what I have been trying:

.cmp - 
<aura:component implements="flexipage:availableForAllPageTypes">
        <aura:attribute name="dataInValue" type="Date" />
        <aura:attribute name="dataEndValue" type="Date"/>

        <lightning:input aura:id="startDate" type="date" label="Enter Date" value="{!v.dataInValue}" onchange="{!c.validDate}"/>
        <br/>
        <lightning:input aura:id="endDate" type="date" label="Day they get benefits:" value="{!v.dataEndValue}"/>
        
</aura:component>
.js - 
({
    validDate : function(component,event,helper){
               var data_in = component.get("v.dataInValue");
               var data_out = formatDate(data_in) + 30;
               component.set("v.dataEndValue", data_out);
    }
})
I am creating a custom lightning component to create an Account record and am wanting to make the field 'Description' taller.  Images below will explain better what I am wanting to do.  I want the input section of the field to be taller like this:

User-added image
Instead of what I currently have:

User-added image
I have been googling trying to figure out how to do this and apparenlty am not entering the correct key words to find a solution. 

Here is the section of code for this portion of the screen:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Description" name="Description" value="{!v.AcctForm.Description}"/>       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Region" name="Region" value="{!v.AcctForm.Region__c }" />       
        </lightning:layoutItem>
    </lightning:layout>

Would greatly appreciate any help that can be provided!
Helo Helpers

I  have a simple  lightning card which has a title and a footer  and in the body  a list  of  string
I  would like  to have different background color for title  section  for Footer section  and if  possible for  the body  section

I guess I  have to play  wiht the STYLEs  and/or  class  but I  am not familiar  with these.
See below  the code of  my  component 

<lightning:card class="slds-text-heading_small slds-card_boundary"   title="attribute1"  footer="attribute2" >
    <div class="slds-p-left--medium slds-p-right--medium">
        <ul class="slds-list--vertical slds-has-dividers--top-space">
            <aura:iteration  items="{!v.items}" var="item" indexVar="i">
                <li class="slds-list__item">                   
                    {!item}
                </li>
            </aura:iteration>
        </ul>
    </div>
</lightning:card> 

Any  sugeston of  code fragment welcommed

thanks in advance 
Csbaa
As we know we navigate from lightning component to lightning component using force:navigateToComponent event along with parameters.
Below is sample code to navigate.
var evt = $A.get("e.force:navigateToComponent"); evt.setParams({ componentDef : "c:myComponent", componentAttributes: { contactName : component.get("<some attribute>") } }); evt.fire();

And we can navigate from lwc to lightning component using below code:
this[NavigationMixin.Navigate]({ "type": "standard__component", "attributes": { "componentName": "c__NavigationDemoComponent" } });

In the second code snippet(from lwc to lightning), how can i pass parameter?
Hello, I have the following simple code:
 
public class SaveAndNewC {
    
    @AuraEnabled
    public static Id saveDetails(Lead regForm1){
        // DML operation to save Lead Details   
        INSERT regForm1;
        return regForm1.Id; 
    }
}

But my current class is only covering 66%:
 
@isTest
private class SaveAndNewC_Test{
  @testSetup
  static void setupTestData(){
    test.startTest();
    Lead lead_Obj = new Lead(LastName = 'LastName836', FirstName = 'First211', Company = 'Company565', Phone = '54343-13889', Status = 'Unqualified', IsConverted = false, IsUnreadByOwner = false);
    Insert lead_Obj;
    test.stopTest();
  }
  static testMethod void test_saveDetails_UseCase1(){
    List<Lead> lead_Obj  =  [SELECT LastName,FirstName,Company,Phone,Status,IsConverted,IsUnreadByOwner from Lead];
    System.assertEquals(true,lead_Obj.size()>0);
    SaveAndNewC obj01 = new SaveAndNewC();
    SaveAndNewC.saveDetails(lead_Obj[0]); 
      //lead_Obj[0]
  }
}

Can you please help? Upon deployment is says as follows:

SaveAndNew

C_Testtest_saveDetails_UseCase1System.DmlException: Insert failed. First exception on row 0 with id 00Qf400000IsyiqEAB; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id] 

Stack Trace: Class.SaveAndNewC.saveDetails: line 6, column 1 Class.SaveAndNewC_Test.test_saveDetails_UseCase1: line 14, column 1
@api recordId not giving record id of the current record lightning page edit action LWC
I have placed LWC component in auracomponent. I have overrided the edit button action with this aura component.
 
<aura:component implements="flexipage:availableForAllPageTypes,lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
	<c:lMCaseNew  recordId="{!v.recordId}"/> // invoking lwc component
</aura:component>
lwc.js
import { LightningElement, track, wire, api } from 'lwc';
import getCaseDetails from '@salesforce/apex/caseController.getCaseDetails';


export default class LMCaseNew extends NavigationMixin(LightningElement) {
@api recordId;

@wire(getCaseDetails, { caseId: '$recordId' })caseRecordDetails({data}){
        if(data){
            alert("data"+data);
        
        }else{
            alert(1);
        }
    }
apex.cls
@AuraEnabled
    public static List<Case> getCaseDetails(String caseId){
        system.debug('record Id'+caseId);
        List<Case> cs = [select Id,Issue_Name__c from Case where Id =: caseId];
        return cs;
    }


It is giving alert(1);
 
Hello,

I am using Progress Indicator component. But I want to hide this if user is accesing the page from mobile or tablet. What is the best way to do that? Thanks in adcance!!

( https://developer.salesforce.com/docs/component-library/bundle/lightning-progress-indicator/example)
Hi All,

How to write soql Query to get recently created 10 records from an Object
Hi All,
I am struggling  to make Down Arrow key to move through list options in autocomplete combobox. Please see what is missing. Below is my code

<aura:component >
<div class="slds-form-element">
<label class="slds-form-element__label" for="combobox-id-22">Relate to</label>
<div class="slds-form-element__control">
<div class="slds-combobox_container">
<div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox">
<div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none">
<input type="text" class="slds-input slds-combobox__input slds-has-focus" id="combobox-id-22" aria-activedescendant="option1" aria-autocomplete="list" aria-controls="listbox-id-12" autoComplete="off" role="textbox" placeholder="Search..." />
</div>
<div id="listbox-id-12" class="slds-dropdown slds-dropdown_length-5 slds-dropdown_fluid" role="listbox">
<ul class="slds-listbox slds-listbox_vertical" role="presentation">
<li role="presentation" class="slds-listbox__item">
<div aria-selected="true" id="option1" class="slds-media slds-listbox__option slds-listbox__option_plain slds-media_small slds-has-focus" role="option">
<span class="slds-media__figure slds-listbox__option-icon"></span>
<span class="slds-media__body">
<span class="slds-truncate" title="Burlington Textiles Corp of America"> Burlington Textiles Corp of America</span>
</span>
</div>
</li>
<li role="presentation" class="slds-listbox__item">
<div id="option2" class="slds-media slds-listbox__option slds-listbox__option_plain slds-media_small" role="option">
<span class="slds-media__figure slds-listbox__option-icon"></span>
<span class="slds-media__body">
<span class="slds-truncate" title="Dickenson plc"> Dickenson plc</span>
</span>
</div>
</li>
<li role="presentation" class="slds-listbox__item">
<div id="option3" class="slds-media slds-listbox__option slds-listbox__option_plain slds-media_small" role="option">
<span class="slds-media__figure slds-listbox__option-icon"></span>
<span class="slds-media__body">
<span class="slds-truncate" title="Edge Communications"> Edge Communications</span>
</span>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
    
</aura:component>

Above code is copy of example given on link
https://www.lightningdesignsystem.com/components/combobox/#Keyboard-interaction

on pressing down key i can go throgh list options but when i copy-paste this code in new component its not working. I am not able to understand.
Thanks,
Vivek




 
apex class
////////////////////////////////////////////////
public list<DRMI_Enrollment__c> activeEnrollments{get;set;} public list<DRMI_Enrollment__c> CurrentsEnrollments{get;set;} public void DrmiCbprPortal() { activeEnrollments = new list<DRMI_Enrollment__c>(); List<DRMI_Enrollment__c> activeEnrollments = [select ProgramId_EI__r.Program_Code__c,Status_EI__c,id,AggregateId__c,City_EI__c,SA_ID_EI__c from DRMI_Enrollment__c where ProgramId_EI__r.Program_Code__c='CBP' and Status_EI__c='2' limit 5]; System.debug('activeEnrollments'+activeEnrollments); } Public list<DRMI_Enrollment__c> getShowList(){ System.debug('@@activeEnrollments'+activeEnrollments); return activeEnrollments;
visualforce page
/////////////////////////////////////////////////

</div> <table class="table table-striped"> <thead> <tr> <th>Name</th> <th>PGE service agreement number</th> <th>Electric meter number</th> <th>Service address and city</th> </tr> </thead> <tbody> <apex:repeat value="{!activeEnrollments}" var="record"> <tr> <td> <apex:outputtext value="{!record.Name }" /> </td> <td> <apex:outputtext value="{!record.ProgramId_EI__r.Program_Code__c }" /> </td> <td> <apex:outputtext value="{!record.Status_EI__c }" /> </td> </tr> </apex:repeat> </tbody> </table>
Hello Folks,

I created a list that loads all attachments related to a custom object, but I need to download them and I am trying to create a link unsuccessfully, someone could help me.
Follow my code

 
AttachmentList.cmp
-------------------------------------------------------------------------------------------------------------




<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" controller="AttachmentListController"> 
    
     
      
     <aura:attribute name="recordId" type="Id"/>
     <aura:attribute name="files" type="List"/>
     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    
    
    
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
             <thead>
            <tr class="slds-line-height_reset">
              <th scope="col"><div class="slds-truncate" title="Name">Anexos</div></th>
              <th scope="col"><div class="slds-truncate" title="tipo">Tipo</div></th>

            </tr>
          </thead>
          
        
        <tbody>
           <aura:iteration items="{!v.files}" var="obj">
                <tr>
                    <th scope="row"> <a href="{!'/portal/servlet.shepherd/version/download/'+obj.Id}">{!obj.Title}</a>   </th> 

                    <!-- <th scope="row"> <a href="{!'/portal/servlet/servlet.FileDownload?file='+obj.Id}" >{!obj.Title}</a>   </th> -->
                  
                  <th scope="row"><div class="slds-truncate" title="Type">{!obj.FileType}</div></th>
                    
                   
                   
                    <td>
                    
                        
	        </td>
                </tr>
            </aura:iteration>
          </tbody>
        </table>
    
    
    
    
	
</aura:component>

AttachmentListController.js
------------------------------------------------------------------------------------------------------------



({
	
    

    doInit : function(component, event, helper) {
			  $A.enqueueAction(component.get('c.getList'));
	},
    
    
    doInit : function(component, event, helper) { 
        $A.enqueueAction(component.get('c.getList')); 
    }, 
    
    
    getList: function(component, event, helper) { 
        var action = component.get("c.getContentDocs"); 
        action.setParams( { 
            arecordId : component.get('v.recordId')
        }); 
        action.setCallback(this, function(actionResult) {
            component.set('v.files',actionResult.getReturnValue()); 
        }); 
        $A.enqueueAction(action); 
    },
    
    
    
    
    
    

    
    
})

AttachmentListController.apxc
---------------------------------------------------------------------------------------------------------



public class AttachmentListController {
    
  @AuraEnabled
    public static List<ContentDocument> getContentDocs(Id arecordId) {
        List<ContentDocumentLink> CDLs = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :arecordId];
        if (CDLs.size() < 1) {
            return new List<ContentDocument>();
        }
        List<Id> CDIdList = new List<Id> (); 
        for (ContentDocumentLink nextCDL : CDLs) { 
            CDIdList.add(nextCDL.ContentDocumentId); 
        } 
        List<ContentDocument> entries = [SELECT Id, Title, FileType FROM ContentDocument WHERE Id IN :CDIdList]; 
        return entries;
    }
     
    
    

}

 
Hi,
I have to navigate LWC to Aura component, so in this scenario how to pass recordId LWC to aura component
can any one help me on this.