• Akash v 6
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 8
    Questions
  • 10
    Replies
Hi,

I have two button and I want to apply CSS on First button click and remove the CSS on the second button click in LWC

Can anyone help me how to do that.

 
Hi All

How do I know what is the px or rem siez for slds element. For example if I am using <div class="slds-p-around_medium"/> and I know if will add some paddig around the div but I would like to know the exact size for top/left/right/bottom.

Thanks,
AK
Hi All,

I am trying to convert a lightning component to web component but not sure how to handle the below situation.
 
<aura:component>
    <aura:attribute name="BolAttribute" type="Boolean"/>
    <aura:attribute name="intAttribute" type="Integer"  default="0"/>
    <lightning:input type="Text" aura:id="inputId" name="input1" label="Enter a Name" />
    <lightning:input type="checkBox" aura:id="checkId" name="checkboxField" label="Yes" />

    <Lightning:button aura:id="button" onClick="{!c.setTrue}" />
</aura:component>

js code
 
({
    setTrue: function(component,event){
                     var checkCmp = component.find("checkId");
                      var isChecked = component.find('checkId').get('v.checked');
                        component.set("v.BolAttribute" ,isChecked);
                      var iVar = component.find("inputId").get("v.value")
                       
                     if(iVar =='Text' && iVar==true){
                             console.log('true');
                      }
     },

})

 
Hi All,

I am trying to convert lightning component to web component but not sure how to handle below situation.

Input.Cmp
 
<aura:component>
    <aura:attribute name="BolAttribute" type="Boolean"/>
    <aura:attribute name="intAttribute" type="Integer"  default="0"/>
<lightning:input type="Text" name="input1" label="Enter a Name" />

    <Lightning:button aura:id="button" onClick="{!c.setTrue}" />
</aura:component>
Input.js
({
    setTrue: function(c,e,h){
        c.set("v.BolAttribute", true);
                      var in = component.find("button").get("v.value")
if(in=='Text'){
console.log('true');
}
    },

})




 
 
Hi,

I have below code the is working fine except the edit button..I want the data to edit and update the row the modal box.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller= "YouTubeSearchController">
    <aura:attribute name="value1" type="String" default="" />
    <aura:attribute name="value2" type="String" default="" />
    <aura:attribute name="idsList" type="Integer" default="1" />
    
    <aura:attribute name="columns" type="List" default="[]"/>
    <aura:attribute name="data" type="List" default="[]"/>
    
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    
    <lightning:layout horizontalAlign="space">
        <lightning:layoutItem size="4">
            <lightning:input name="input1" value="{!v.value1}" label="Field 1" />
        </lightning:layoutItem>
        <lightning:layoutItem size="4">
            <lightning:input name="input2" value="{!v.value2}" label="Field 2" />
        </lightning:layoutItem>
        
        <lightning:layout horizontalAlign="space">
            <lightning:layoutItem size="4">
                <lightning:button variant="base" label="Add Field" title="Add Field" onclick="{! c.handleClick }"/>
            </lightning:layoutItem>
        </lightning:layout>
        
    </lightning:layout>
    <lightning:layout horizontalAlign="space">
        
        
        <lightning:layoutItem size="4">
            <lightning:datatable
                                 columns="{! v.columns }"
                                 data="{! v.data }"
                                 keyField="id" 
                                 onrowaction="{! c.handleRowAction }"
                                 hideCheckboxColumn="true"/>
        </lightning:layoutItem>
    </lightning:layout>
</aura:component>
 
({
    init:  function(component, event, helper) {
        component.set('v.columns', [
            {label: 'Concatenated Result', fieldName: 'concatenatedResult', type: 'text'},
            {label: 'View', type: 'button', initialWidth: 135, typeAttributes: { label: 'Edit', name: 'edit', title: 'Edit'}},
            {label: 'Remove', type: 'button', initialWidth: 135, typeAttributes: { label: 'Remove', name: 'remove', title: 'Remove'}}
        ]);  
    },
    handleClick : function(component, event, helper) {
        
        var listID= component.get("v.idsList");
        
        // concatenate Strings 
        var value1 = component.get("v.value1");
        var value2 = component.get("v.value2");
        var newVal = value1+value2;
        var data = component.get("v.data");
        var obj = {  "id": listID,
                   "concatenatedResult": newVal};
        data.push(obj);
        component.set("v.data", data);
        component.set("v.idsList", parseInt(component.get("v.idsList"))+1);
    },
    handleRowAction : function(component, event, helper) {
        var action = event.getParam('action');
        var row = event.getParam('row');
        var data = component.get('v.data');
        switch (action.name) {
            case 'edit':
                //modal logic may come here
                break;
            case 'remove':
                data = data.map(function(rowData) {
                    if (rowData.id == row.id) {
                        let confirmed = confirm("Are you sure?");
                        if (confirmed === true) {
                            data = data.filter(element => element.id != row.id);
                            component.set("v.data", data);
                            alert("This has been Deleted");
                        }
                        else{
                            return;
                        }
                    }
                });
                break;
        }
    }
})


 
Hi All.

I am trying to navigate from Component to Community buidler page and tried below code it did not work though I am not getting any error.

The button is not in Lighting app it is in commuity within the lightning component.

 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
 <lightning:navigation aura:id="navService"/>
 <lightning:button label="Navigate" onclick="{!c.handleClick}"/>
</aura:component>
({
    handleClick: function(cmp, event, helper) {
     var navService = cmp.find("navService");
     var pageReference = {
                         "type": "standard__component",
                         "attributes": {
                                         "componentName": "c__WebinarOverride"
                                       }, 
                         "state": {
                             'message':'This is the target page'
                         }
                        };
     navService.navigate(pageReference);
    }
})
 
({
	doInIt : function(component, event, helper) {
		 var id = component.get("v.pageReference").state.message; 
                 var toastEvent=$A.get('e.force:showToast');
                    toastEvent.setParams({
                      title:'Rendering page',
                      message:id,
                      key:'info_alt',
                      type:'info',
                      mode:'pester'
               });
        toastEvent.fire();
	}
})



 
Hi All,

I have Lighting Form with 2 Field if the uses click on the add button then concatenate these two fields and show in the table

2
Hi Folks,

Probem Description -
I have two difrrent class and diffrent visualforce. Earch class has findaddress() method.. and in the method I am trying to find the address based on user input..check the below class with method.

Question -
How to put the findaddress() logic in the helper method so that I can call in the both class without reating the same code..

something like this
findaddress(string streeaddress, string city, string zip ){

//?

}



Class A:
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && myproject.Street_Address__c!=''){  //myproject is an object instance
            strSplittedAddress=myProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{myProject.City__c};
        request.province = new List<String>{myProject.State__c};
        request.postalCode = new List<String>{myProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune 


Class B
 
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && anotherProject.Street_Address__c!=''){  //anotherProject is an object instance
            strSplittedAddress=anotherProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{anotherProject.City__c};
        request.province = new List<String>{anotherProject.State__c};
        request.postalCode = new List<String>{anotherProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune



 
Hi All,

I am trying to convert lightning component to web component but not sure how to handle below situation.

Input.Cmp
 
<aura:component>
    <aura:attribute name="BolAttribute" type="Boolean"/>
    <aura:attribute name="intAttribute" type="Integer"  default="0"/>
<lightning:input type="Text" name="input1" label="Enter a Name" />

    <Lightning:button aura:id="button" onClick="{!c.setTrue}" />
</aura:component>
Input.js
({
    setTrue: function(c,e,h){
        c.set("v.BolAttribute", true);
                      var in = component.find("button").get("v.value")
if(in=='Text'){
console.log('true');
}
    },

})




 
 
Hi All,

I have Lighting Form with 2 Field if the uses click on the add button then concatenate these two fields and show in the table

2
FieldHistoryArchive__b = new FieldHistoryArchive__b();
                    Fes.ArchiveParentName='test';
                    Fes.ArchiveParentName='testField'; 
                    Fes.ArchiveParentType='text1';
                    Fes.CreatedById='99999';
                    Fes.CreatedDate='147017029742';
                    Fes.Field='tracking';
                    Fes.FieldHistoryType='hii'; 
                    Fes.HistoryId='78909';
                    Fes.Id='5000';    
                    Fes.NewValue='new';
                    Fes.OldValue='old'; 
                    Fes.ParentId='900';
 database.insertImmediate(Fes);
im inserting values  but im getting invaidType object 
Hi Folks,

Probem Description -
I have two difrrent class and diffrent visualforce. Earch class has findaddress() method.. and in the method I am trying to find the address based on user input..check the below class with method.

Question -
How to put the findaddress() logic in the helper method so that I can call in the both class without reating the same code..

something like this
findaddress(string streeaddress, string city, string zip ){

//?

}



Class A:
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && myproject.Street_Address__c!=''){  //myproject is an object instance
            strSplittedAddress=myProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{myProject.City__c};
        request.province = new List<String>{myProject.State__c};
        request.postalCode = new List<String>{myProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune 


Class B
 
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && anotherProject.Street_Address__c!=''){  //anotherProject is an object instance
            strSplittedAddress=anotherProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{anotherProject.City__c};
        request.province = new List<String>{anotherProject.State__c};
        request.postalCode = new List<String>{anotherProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune



 
hi,
i need to count the characters from all the fields in visualforce page. currently i am able to count the characters from single field. can anyone help me to count the characters from all fields?

<script>
        var i;
        function ShowCharCount(myTA, maxSize, SizeLabel) {
                i=maxSize-myTA.value.length;
                document.getElementById(SizeLabel).innerHTML =  'Word Count: '+ i + ' Characters Left';
                i= maxSize; 
        }
</script>


<apex:inputField value="{!c.name__c}"
                    onchange="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onmousedown="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onkeyup="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onkeydown="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onclick="ShowCharCount(this, 2000, '{!$Component.myTASize}');" />

<apex:inputTextarea value="{!c.address__c}"
                   onchange="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onmousedown="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onkeyup="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onkeydown="ShowCharCount(this, 2000, '{!$Component.myTASize}');"
                    onclick="ShowCharCount(this, 2000, '{!$Component.myTASize}');"  />

<apex:outputPanel id="myTASize"></apex:outputPanel>
I need to use Today's date in a format like 2016-03-22T03:44:34.000-07:00 in a where clause in a query. Can you please help how to format this.
like 

SELECT id,name,SubscriptionId,createdDate FROM Amendment where createdDate = today

and today needs to be in this format, e.g.
2016-03-22T03:44:34.000-07:00

So, if I get system.today(); I need your help how to format that as I mentioned above.

Thank you
Apex: 
<apex:page controller="allObjectListClass">
    <apex:pageBlock>
        <apex:form id = "myForm">
            
            <apex:pageBlockSection>
                <apex:selectList id="objList" value="{!selectedObj}" size="1">
                    <apex:selectOptions value="{!objName}"/>
                    <apex:actionSupport event="onchange" reRender="myForm"/>
                </apex:selectList>  
            </apex:pageBlockSection>
            
            <apex:pageBlockSection>
                <apex:pageblockTable value="{!fieldName}" var="f">
                    <apex:column value="{!f}"/>
                </apex:pageblockTable>
            </apex:pageBlockSection>
            
        </apex:form>        
    </apex:pageBlock>    
</apex:page>
Controller :
public class allObjectListClass {
    public String selectedObj {get;set;}
    
    public static List<selectOption> getObjName(){
        List<selectOption> options = new List<selectOption>();
        
        for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
        {
            Schema.DescribeSObjectResult objResult = o.getDescribe();           
            system.debug( 'Sobject API Name: ' + objResult.getName() +' Sobject Label Name: ' + objResult.getLabel());           
            options.add(new SelectOption(objResult.getName(),objResult.getLabel()));
        }
        return options;
    }
    
    public static List<String> getFieldName(){
        List<String> reqFields = new List<String>();
        /*
			Required Code 
		*/
        return reqFields;
    }
}
I am getting a hard time dealing with schema methods, i have gone through the Salesforce documentation though.
Thanks in advance...


 

I have a visualforce page rendered as a PDF called "Agreement" that is generated from a button on a custom object called "Agreements". The "Agreements" object has a field that identifies the Account (standard SF object) the Agreement is associated with. When saving or downloading the PDF, the name of the file is always the name of the visualforce page (Agreement.pdf). How can I define the file name when saved or downloaded as the following:

Account: Demo Tech,LLC.

Save PDF filename: Demo Tech,LLC._Agreement_Today's Date

PS. I know this has been asked before by others, but the apex class "solutions" I've read did not work for me.