• piyush_soni
  • ALL STAR
  • 8788 Points
  • Member since 2016
  • Salesforce Developer
  • ACS


  • Chatter
    Feed
  • 281
    Best Answers
  • 17
    Likes Received
  • 20
    Likes Given
  • 2
    Questions
  • 1170
    Replies
So I've created an iframe that bring info from an external system. The thing is the UI is not the greatest, when I increased the length of the iframe, it does not seem to affect the (what I think is) the lightning component. My question is really in the image below:

User-added image
Hi all,

I need a list with all deleted records on a specific object showing me when these records were deleted. The date range is for example, from 1.1 - 31. January this year.
What I could find is how to show deleted records with SOQL where you add the "IsDeleted" column, but nowhere you can find how to add a column "Deletion date" or something like that.

I can not use the Workbench because of IP restrictions, but I can use the Data Loader. If I use the Developer Console, I don't know if it is possible to export the results in an excel or text or CSV file.

Does anybody here have an idea from experience?
In one interview i had a question like How many relationship can be defiend on junction object??
 
My ans was one : i.e Many To Many Relationship

is it correct//
I have to add 50+ fields to two custom objects and add 20+ fields to Account object. Looking for a tool which will make this easier. 
I have designed a lightning component to fetch record details. I am having this lightning component in the record detail page. I am also having picklist field inside the component. When I simply place picklist field inside component and try to fetch and display picklist values inside the component its working.
 
<aura:attribute name="recordId" type="String" default="{!v.recordId}"/> 
     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
      <aura:attribute name="myObject" type="String" default=""/>
   <aura:attribute name="objInfo" type="case" default="{sobjectType : 'Case'}" />
 <div id="gee" class="slds slds-scrollable--x">

   <ui:inputSelect aura:id="cirjustification" class="slds-select" label="" value="{!v.myObject.CIRJustification__c}"/> 
<lightning:button variant="brand" label="Submit" onclick="{!c.myAction}" />
 </div>

But if I add lightning tabset to the code, I am getting apex error.
<lightning:tabset >
  <lightning:tab label="Main">    
  <div id="gee" class="slds slds-scrollable--x">
   <ui:inputSelect aura:id="cirjustification" class="slds-select" label="" value="{!v.myObject.CIRJustification__c}"/> 
<lightning:button variant="brand" label="Submit" onclick="{!c.myAction}" />
 </div>
   </lightning:tab>
</lightning:tabset>

Error : 
User-added image
I can find that the error is because the value cannot be set properly, but don't know how to do this. Can anyone help?
My controller code
({

 doInit: function(component, event, helper) {
    helper.fetchPickListVal(component, 'CIRJustification__c', 'cirjustification');
}
})

Helper code​
({
fetchPickListVal: function(component, fieldName, elementId) {
    var action = component.get("c.getselectOptions");
    action.setParams({
        "objObject": component.get("v.objInfo"),
        "fld": fieldName
    });
    var opts = [];
    action.setCallback(this, function(response) {
        if (response.getState() == "SUCCESS") {
            var allValues = response.getReturnValue();

            if (allValues != undefined && allValues.length > 0) {
                opts.push({
                    class: "optionClass",
                    label: "--- None ---",
                    value: ""
                });
            }
            for (var i = 0; i < allValues.length; i++) {
                opts.push({
                    class: "optionClass",
                    label: allValues[i],
                    value: allValues[i]
                });
            }
            component.find(elementId).set("v.options", opts);
        }
    });
    $A.enqueueAction(action);
},


Apex class
@AuraEnabled
  public static List < String > getselectOptions(sObject objObject, string fld) {
system.debug('objObject --->' + objObject);
 system.debug('fld --->' + fld);
 List < String > allOpts = new list < String > ();
 // Get the object type of the SObject.
Schema.sObjectType objType = objObject.getSObjectType();

// Describe the SObject using its object type.
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();

// Get a map of fields for the SObject
map < String, Schema.SObjectField > fieldMap = objDescribe.fields.getMap();

// Get the list of picklist values for this field.
list < Schema.PicklistEntry > values =
 fieldMap.get(fld).getDescribe().getPickListValues();

// Add these values to the selectoption list.
for (Schema.PicklistEntry a: values) {
 allOpts.add(a.getValue());
}
system.debug('allOpts ---->' + allOpts);
allOpts.sort();
return allOpts;
}

 
Hi all,

I am new to Visualforce. I want to display Account records, then when we click on the name, a popup box (Modal Popup only) should be opened displaying the name and phone number.

Below is my code.
 
<apex:page standardController="Account" recordSetVar="accnt" tabStyle="Account" >  
    <script type="text/javascript">
        var popupbox = new SimpleDialog("Test", true);
        popupbox = createDialog();
    	function OpenPopup(){
            popupbox.setTitle("Account Detail");
            popupbox.importContentNode(document.getElement.Id("{!$Component.popupbox}"));
            popupbox.show();
 		}
    	OpenPopup();
	</script>
    <apex:form >
    <apex:outputPanel style="display:none">
    	<apex:outputPanel id="popupbox" layout="block">
        	<p>Click OK to Cancel...</p>
        	<apex:commandButton value="Ok" onClick="popupbox.hide()" />
    	</apex:outputPanel>
	</apex:outputPanel>
 
    	<apex:pageBlock title="Accounts" >
         	<apex:pageBlockTable value="{!accnt}" var="ac" >
                <apex:column id="two">
                	<apex:commandButton value="Click" onclick="OpenPopup();" reRender="two"/>
                </apex:column>
            	<apex:column value="{!ac.Name}" />
                <apex:column value="{!ac.AccountNumber}" />
                <apex:column value="{!ac.Type}" />
                <apex:column value="{!ac.Rating}" />
                <apex:column value="{!ac.Phone}" />
                <apex:column value="{!ac.billingCity}" />
                <apex:column value="{!ac.billingCountry}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Popup is not showing up and I don't understand how to display records on a popup. Please help me. Thanks.
Hi Team,


I am not able to call apex method from my lightning component controller even after enabling aura.
getting following error-

This page has an error. You might just need to refresh it. Unknown controller action 'getAccounts' Failing descriptor: {markup://c:AccountList}

Anybody please help me.
Here is the code-

component-
<aura:component controller="AccountListAuraController">
    <aura:attribute name="Accounts" type="Account[]"/>    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <div>
        <h2>Account List</h2>
        <aura:iteration items="{!v.Accounts}" var="acc">
            <p>Here is the list : {!acc}</p>
        </aura:iteration>
    </div>
</aura:component>

controller-
({
    doInit : function(component) {
        var action= component.get("c.getAccounts");
        action.setCallback(this,function(response){
            var state= response.getState();
            $A.log(response);
            if(state=="success"){
                component.set("v.Accounts",response.getReturnValue());
            }
            
        });
        $A.enqueueAction(action);
    }
})

apex class-
public with sharing class AccountListAuraController {
@auraEnabled
public static List<Account> getAccounts(){
        
        return [select name, id , description from Account ];
    }
}

Thanks in advance.
I am very new to lightning and have a basic issue with creating a button. My requirement is that when i click on 'check my budget' button it should redirect me to the corresponding budget record of that expense.
Budget-Master object; Expense-detail object

Budgetdisplay.cmp
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" controller="budgetlightningcntrl" >
    <aura:attribute name="expense" type="Expenses__c[]"/>
    <aura:attribute name="spinner" type="Boolean" default="false"/>
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>    
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>     
  <aura:handler event="force:navigateToSObject" action="{!c.navigate}"/>   
   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
  <aura:if isTrue="{!v.spinner}">
    <div aura:id="spinnerId" class="slds-spinner_container">
       <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
         <span class="slds-assistive-text">Loading</span>
         <div class="slds-spinner__dot-a"></div>
         <div class="slds-spinner__dot-b"></div>
       </div>
    </div>
 </aura:if>
        
    <table class="slds-p-around_x-small slds-text-body_small slds-table slds-table--bordered slds-table--fixed-layout " >
                <thead>
                    <tr>                        
                        <th scope="col" colspan="3" class="slds-truncate slds-text-align--center slds-text-align--center 
                                                           slds-text-align_right slds-text-heading_medium">My Budget and Expenses</th>
                    </tr>
                    <tr>                        
                        <th scope="col"><div class="slds-truncate ">My Budget</div></th>
                        <th scope="col" ><div class=" slds-text-align--center">Expenses ID</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Amount</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Status</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Mode of Travel</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Date of Expense</div></th>
                    </tr>
                </thead> 
        <tbody>
            <aura:iteration items="{!v.expense}" var="e">
                <tr class="slds-hint-parent" >
                    <td>
                        <button type="button" onclick="{!c.navigate}" id="{!e.Budget__r.Id}">check Budget</button>                      
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right" >
                                <a target="_blank" href="{!'/'+e.Id}">{!e.Name}</a>                                 
                                </div>
                                </td>
                            <td scope="row">
                                 <div class="slds-truncate slds-text-align--right"><ui:outputNumber value="{!e.Amount__c}"/></div>
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Status__c}" /></div>                            
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Mode_of_Travel__c}"/></div>
                            </td>  
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputDate value="{!e.Date_of_Expense__c}"/></div>
                            </td>
                        </tr>            
            </aura:iteration>
          </tbody>
       </table>
</aura:component>

Budgetdisplaycontroller.js
({
    doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getexpense");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.expense", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    navigate: function(component, event, helper) {
  var idx = event.currentTarget.id;
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
      "recordId": idx
        });
    navEvt.fire();

}
,
    showSpinner: function(component,event,helper){
        component.set("v.spinner",true);
    },
    
    hideSpinner: function(component,event,helper){
        component.set("v.spinner",false);
    }
    
})
Hi, 

   String Alpha = ' A; B; C; D'; 
   String SearchString = 'A'
   I want to split the above string value as 

     A
     B
     C
     D

    Also Please suggest me how to search a string in list. 

Thanks
Sudhir
   

   
Hello, i have a simple trigger:


trigger TriggerA on Account (before insert) {
    for(Account a : Trigger.new){
      if(a.Description == NULL)
         a.addError('You must add a value');
    }
}

Error: Compile Error: Variable does not exist: Description at line 3 column 12. I don't understand why.
Hi,
I have a query on Opportunities which I know how to store in a List<Opportunity>.
But I need to store the SUM of all Amounts in that list, into a variable (so I can use such variable in an equation later on)
How can I store the result of the SUM into such a variable.

Here is my query:
List<Opportunity> amountUserClosedWonOppties = [SELECT Id, Amount
                                                        FROM Opportunity
                                                        WHERE (LastModifiedDate = THIS_WEEK
                                                               AND LastModifiedById = : UserInfo.getUserId()
                                                               AND IsWon = true)
                                                        OR (CreatedDate = THIS_WEEK
                                                            AND CreatedById = : UserInfo.getUserId()
                                                            AND IsWon = true)];

Thank you.
trigger CreateRenewal on Opportunity (before update) {

  Map<Id, Opportunity> renewals = new Map<Id, Opportunity>();

  for (Opportunity opp : Trigger.new) {
 
    if (opp.CloseDate <= opp.CloseDate - 30) {
       Opportunity renewal = new Opportunity();
       renewal.AccountId   = 'opp.AccountId';
       renewal.Name        = opp.Name + 'Renewal';
       renewal.CloseDate   = opp.CloseDate + 365;
       renewal.StageName   = 'Open';
       renewal.RecordType  = 'Renewal';
       renewal.OwnerId     = opp.OwnerId;
       renewals.put(renewal.Id, renewal);
    }
  }

   insert renewals;
}

 
Hello, I am working on lightning component and stuck on scenario is there any way to switch one lightning component to another component when both are in different lightning pages.  
Please Help Me.
Thanks In Advance. :)
I was wondering if anybody knew of a way to edit or add actions to a Kaban tile. Something along the lines of a send email action or a change record type action below the 'Change Owner' button in the picture below. Thank you in advance.
Actions that I would like to add to.
Hmm, here I am again, different question this time. 
When I try to make a page/event layout, I have to press the button below Salesforce Mobile and Lightning Experience Actions to be able to change it.
When I do it, it seems open, but there are a lot of fields I can't seem to put under Salesforce Mobile and Lightning Experience Actions... And I need to do it when following a Trailhead regarding Page Layouts.

Hope you can help!
Hi, 

  I am using a below formula  Here Resller Discount = 25% and Margin = 7%
Disti discount% =  Margin% * (1-Reseller dicount%) + Reseller discount%
 If I use above formula in excel it is giving Disti Discount= 30.35%

 I am using the same formula in salesforce Apex but Disti Discount  is returning as 25% it self Please suggest me what might be the mistake in this math opeation I am doing
public PageReference addDistiDisc() {
        Decimal Margin = 7/100;
        Decimal Ddisc;
        Decimal Rdisc;
       for(QuoteLineWrapper qw : lines) {
         Rdisc = Decimal.Valueof(qw.qline.Reseller_Discount__c)/100;
         Ddisc = Margin  * (1 - Rdisc  ) + Rdisc ;
         qw.qline.Disti_Discount__c =  String.Valueof( (Ddisc) * 100);
         updateTotal(qw);
         qw.isChanged = true; 
        } 
      return null;
    }

Thanks
Sudhir
 
Hello, I thought I followed all the steps but I am getting and error. The field 'Contact__c' either does not exists on the Offer__c object or it is not lookup relationship. Here is a screenshot of the Fields & Relationships on the Offer Object. Please let me know what I am missing. Thanks! User-added image
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis
Opportunity opp = [select id,(select id,Test__c,Name,from Vendor_Groups__r) from opportunity where id =: oppid];

system.debug('@@@@Check1'+opp.Vendor_Groups__r);   No compile error
system.debug('@@@@Check1'+opp.Vendor_Groups__r.
Test__c);   Compile error as shown below
Error: Compile Error: A non foreign key field cannot be referenced in a path expression: Vendor_Groups__r
 
Hi Team,

How to design test class as per best practices for these trigger handler with code coverage 

class
public without sharing class ContactTriggerHandler {
		public static void onAfterUpdate(list<Contact> newList,Map<Id,Contact> oldMap){
			list<account> filerAccountList = filerAccounts(newList);
			if(!filerAccountList.isEmpty()){
				update filerAccountList;
			}
		}
		
		public static void onAfterInsert(list<Contact> newList){
			list<account> filerAccountList = filerAccounts(newList);
			if(!filerAccountList.isEmpty()){
				update filerAccountList;
			}
		}
	
		public static void onAfterDelete(Map<Id,Contact> oldMap){
			list<account> filerAccountList = filerAccounts(oldMap.values());
			if(!filerAccountList.isEmpty()){
				update filerAccountList;
			}
		}
		
		private static list<account> filerAccounts(list<contact> contactList){
		 set<id> accountIdSet = new set<id>();
			for(contact con : newList){
				if(con.accountId != null){
					accountIdSet,add(con.accountId);
				}
			}
			list<account> accountToUpdateList = new list<account>();
			date latestdate = Date.newInstance(2008, 1, 1);
			for(account acc : [select Id, Date__c,(select Id,Date__c from contacts order by Date__c desc limit 1) from account]){
					for(contact con : acc.contacts){
						if(latestdate < con.Date__c){
							acc.Date__c = con.Date__c;
							accountToUpdateList.add(acc);
						}
					}
			}
			return accountToUpdateList;
		}
}



trigger
trigger LatestDateContact on Contact (after insert,after update,after delete) {
 if(Trigger.isAfter){
		if(Trigger.isUpdate) {   
	         ContactTriggerHandler.onAfterUpdate(trigger.new,trigger.oldMap);      
	    }else if(Trigger.isInsert) {
	         ContactTriggerHandler.onAfterInsert(Trigger.new);
	    }else if(Trigger.isDelete) {
	         ContactTriggerHandler.onAfterDelete(trigger.OldMap);
	    }
	}
}

Thanks for advance.
 
Hi All,
Actually, I wrote all the business logic in the lightning controller and helper class, Becuase of that it is exposing all the business logic and data in browser console when I click on "inspect element" option. How do I stop exposing controller code and data in browser console? Is there any way or any feature of lightning which can do this? 
Hi All,

I'm unable to create Multi-select picklist in .design class in lightning component with design:attribute, Its not allowing to add datasource to that Multi-select picklist.

Error I got is: Failed to save MyComponent.design: Only String attributes may have a datasource in the design file.: Source

My code is:
MyComponent.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
    
    <aura:attribute name="MyVelues" type="String[]" />
</aura:component>
MyComponent.design
<design:component label="MyComponent">

    <design:attribute name="MyVelues" datasource="value1,value2,value3" default="value1" />
    
</design:component>
If anyone could help it would be appreciated.
Thanks,
Vinay
 
I'm trying to display a check box field using lightning:datatable component.

Here is the component markup.
<aura:component>
    <aura:attribute name="invoices" type="Invoice__c[]"/>
    <aura:attribute name="columns" type="List"/>

    <aura:handler name="init" value="{! this }" action="{! c.init }"/>

    <lightning:datatable data="{! v.invoices }" columns="{! v.columns }" keyField="id"/>
</aura:component>
And this is my init controller method
init : function(component, event, helper) {
        component.set("v.columns",[
            {label:"Invoice Number", fieldName:"Name",type:"text"},
            {label:"Date", fieldName:"Date__c",type:"date"},
            {label:"Amount", fieldName:"Amount__c",type:"currency"},
             {label:"Paid", fieldName:"Paid__c",type:"text"}
        ]);
        
		var action = component.get("c.getInvoices");
        action.setCallback(this,function(response){
            component.set("v.invoices",response.getReturnValue());
        });
        $A.enqueueAction(action);
}
This is the output.

datatable output

All data is populated on the table except Paid__c, which is a checkbox. How do you display a checkbox field in a datatable? I have tried changing the type to boolean and checkbox without any luck. The documentation for neither lightning:datatable nor lightning:formattedText talks about displaying checkbox fields.
Hi All,
I am trying to retrieve a list of records for a custom object (Fact_Finder__c) which has the same Account name as the Opportunity in where the list is displayed (in a Ligthning Component). There is a master detail relationship between the Opportunity (parent) and the Fact Finder (child).
My current code (below) retrieve records for this particular Opportunity but what I want to achieve is retrieving all the Fact Finders with the same Account name in all Opportunities.


public with sharing class FFsamePolicysameClient {
   
    @AuraEnabled     
    public static List<Fact_Finder__c> getallFF(String recordId){ 
       List <Fact_Finder__c> FF = [SELECT Id, Name, RecordType.Name, Date__c, Client_Name__r.Name, Policy__r.Name, Opportunity_Name__r.Name FROM Fact_Finder__c Where (Opportunity_Name__c =:recordId) ORDER BY Date__c DESC];
      return FF;        
    }
}

 I have tried many different ways but nothing seams to work.
Any help will be greatly appreciated.
Thanks in advance.
Sylvie

 
So I've created an iframe that bring info from an external system. The thing is the UI is not the greatest, when I increased the length of the iframe, it does not seem to affect the (what I think is) the lightning component. My question is really in the image below:

User-added image
Hello all, I have done alot of modifications in the sandbox and wanted to deploy the changes in the production (I do not have production access, so I want to make less mistakes in change set)

I have added new custom fields, updated existing page layputs, uptdated triggers. updated existing custom fields, updated apex classes, and updated visualforce page.

I would like to know what is the best sequence to add the components to the change set? 

Or is it good practice to create multiple change sets?

Any suggestions on this?
System.LimitException: Apex CPU time limit exceeded
Hi all,

I need a list with all deleted records on a specific object showing me when these records were deleted. The date range is for example, from 1.1 - 31. January this year.
What I could find is how to show deleted records with SOQL where you add the "IsDeleted" column, but nowhere you can find how to add a column "Deletion date" or something like that.

I can not use the Workbench because of IP restrictions, but I can use the Data Loader. If I use the Developer Console, I don't know if it is possible to export the results in an excel or text or CSV file.

Does anybody here have an idea from experience?
Im using ui:inputDate  to display date filed ,
Is there any solution to disable the past dates in date picker?
HI all,


How to increase the character size of custom field (LongTextArea)...?
By default it's charactor limit is 131072 characters (128 kB). I want to save more charactors in same field.

Please let me know If anyone have the solution for this problem..

Thanks in Advanced,
Puja
My requirement is that when i check the checkboxes and click on delete button the records need to be deleted.
I am getting the following error while trying to click on delete button(created in parent cmp) which accesses the delete method in its child component.
Please help as I am not able to find out what is wrong..

"This page has an error. You might just need to refresh it. Action failed: c:Budgetdisplay$controller$delparent [chn.deletemethod is not a function] Failing descriptor: {c:Budgetdisplay$controller$delparent}"

Parent component
<aura:component>
<table>
<thead>
<!--data table-columns--->
 <lightning:button label="Delete"                         
                          variant="brand"
                          onclick="{!c.delparent}"/>                         
             
                    </thead> 
    <!-- ITERATION -->
             <tbody>
                      <aura:iteration items="{!v.expense}" var="e" indexVar="sNo">
                       <!-- Child Lightning Component --> 
                    <c:inlineedit aura:id ="inline" singleRec="{!e}"
                                     showSaveCancelBtn="{!v.showSaveCancelBtn}"
                                     sNo="{!sNo + 1}" />
            </aura:iteration>
</tbody>
</table>
</aura:component>

parent controller

delparent : function(component,event,helper){
      var chn = component.find("inline");
        chn.deletemethod();
    }

child component
<aura:component>
 <!--Table Row Start-->  
        <aura:method name="deletemethod" action = "{!c.delete}" access="global"/>       
       <tr class="slds-hint-parent" >
           <td>
           <ui:inputCheckbox aura:id="eachbox" text="{!v.singleRec.Id}" />
           </td>
    <!---other rows--->
         </tr>
</aura:component>

child controller
delete :function(component, event, helper){
    
    var delid = [];
    var getAllId = component.find("eachbox");
    console.log('getallid'+getAllId);
    
    if(! Array.isArray(getAllId)){
         if (getAllId.get("v.value") == true) {
           delid.push(getAllId.get("v.text"));
         }
     }
else{
      for (var i = 0; i < getAllId.length; i++) {
       if (getAllId[i].get("v.value") == true) {
         delid.push(getAllId[i].get("v.text"));
       }
      }
     }      
  
    console.log('testdelid'+delid);
    helper.deleteSelectedHelper(component, event, delid);
      
      },
    
Hi ,
I have implemented Digital signature using Visualforce pages and java script. It's working good in desktop and Ipad. I am facing problems in android devices. Can some one suggest the possible solution for this OR share thoughts/implementation using Lightning components please ? 

Regards,
Chethan.S.N
Hi ,

I am getting an issue when uploading jquery script file  to get pagination in lightning component.
Issue is  
Uncaught TypeError: Cannot read property 'expando' of undefined throw

 
I am using a lightning:datatable to display various fields, including a URL field which links to a printable PDF.

In the Spring 18 release, the URL field in the datatable now points to "javascript:void(0)" in the href attribute and the title attribute now contains the url which I am trying to set in the href field. 

Can someone please provide me a code example on how to get the href refrecne to work correctly?
Hi All,  

Just had a query, how can I create a custom tab on accounts page like news, related list, details in lightning? Also, how can that be brought in salesforce1 app?  We had creted such custom tabs in the account page b ut those are  visible only in desktop but not in mobile. What am I missing?

Thanks for the response
Hi 

I have scnerio where I need to capture IP address of current User in Lightning Community, is any way standard way  where I can capture IP address inside Lightning Components.
I have seen third party tools like - https://www.ipify.org/ to get Ip address 
Any recommendations are appreciated 

Thanks 
Hi all,

Im currently facing an issue with the "e.force:createRecord" when trying to pre populate some fields from an object to another one. Im using the "defaultFieldValues" and almost every field is populated correctly (Lookup, text,etc) except Currency and Master-Detail.

For your understanding of the issue, when i query the data and show it on the console its shows completly fine ("234" currency field), but at the moment to pre populate it just dont, it keeps the field blank. Also ive tried to: ParseInt, Integer the value, and nothing.
Also, the fuctionallity on Classic mode it working fine, so its not a permision issue (Profile, FLS,etc).

Do you know why is this happenening? Happens to 2 different currency field and also to the master-detail (havent reasearch or even tried anything on this but if you can help also i will appreciate it).

Thanks!!
Hi All,

Getting the below error when i click on quick action containing a lightning component. 
Action failed: forceChatter:lightningComponent$controller$doInit (undefined is not an object (evaluating 'fn-apply')]

quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent

Let me know what the issue could be.
<aura:component controller="SOWManager_CTL" implements="flexipage:availableForAllPageTypes">

      <aura:attribute name="theaters" type="String[]"/>
      <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
      <form>      
           <div class="header">
               <div style="margin-left:15%;float: left; margin-top:0.5%;" >
                 SOW ID : <ui:outputText aura:id="sowID"  value="{!v.Name}" />
             </div>
             <div style="margin-left:50%;float: left;margin-top:0.5%;">
                 SOW Status : <ui:outputText aura:id="sowStatus"   value="{!v.SOW_Status__c}" />
             </div>
         </div>     
        <lightning:tabset >
        <lightning:tab label="General Info">
             <fieldset class="slds-form--compound" style="margin-left:15%;margin-right:15%">
               <div class="slds-form-element__group">
                <div class="slds-form-element__row">
                  <div class="slds-form-element slds-size--1-of-2">
                      <lightning:select  name="theaterGeo"  label="Theater/Geography" required="true">
                          <option value="" text="Select Theater/Org"></option>
                          <aura:iteration items="{!v.theaters}" var="theater">
                            <option value="{!theater}" text="{!theater}"></option>
                        </aura:iteration>
                    </lightning:select>
                  </div>
                  <div class="slds-form-element slds-size--1-of-2">
    
                   </div>
                </div>
              </div>
            </fieldset>
        </lightning:tab>
 
    </lightning:tabset>

        
       
    </form>
</aura:component>
HI,
I am working on lightning component where I need progress indicator. I am using slds progress indicator but it is not showing css same as shown in the slds guide.
I have used the same code mentioned in the guide.https://www.lightningdesignsystem.com/components/progress-indicator/#flavor-base-default
But still it is not showing connecting line of two button. please find screenshot of issue.User-added image
According to guide image bar should look likeUser-added image

Please help me on the same

Thanks
Shikha
One approach we have tried is having a Lightning Component with a button and adding the component to the specific record page, however this approach makes the UI inconsistent.
Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
Hi folks, 

I try to complete the "Build a Battle Station App" -> Modify the User Experience. Trail to complete. I checked everything and did it 3 times but every time I get the error:

Challenge Not yet complete... here's what's wrong: 
The 'Resources' related list was not found on the Page Layout 
Note: you may run into errors if you've skipped previous steps.

The Resources Column is in the Page Layout and I add the needed objects. 

Anybody an Idea?
Hi All,
Is there a way to bookmark a question from this forum?
Suppose a come across a question and I want to bookmark that question for future refrence. Can I do that?
Currently I am commenting on the already answered questions as a way to bookmark it.

Thanks,
Sathwick
Hi,
I was going through practice session about constructors but my program keeps on failing

I used the code:
public class TestObject2{
    private static final Integer DEFAULT_SIZE = 10;

    Integer size;

   //Constructor with no arguments
   public TestObject2() {
       this(DEFAULT_SIZE); // Using this(...) calls the one argument constructor    
   }

   // Constructor with one argument 
   public TestObject2(Integer ObjectSize) {
     size = ObjectSize;  
   }
}


and At Execute Anonymous Window Giving:

TestObject2 myObject1 = new TestObject2(42);
TestObject2 myObject2 = new TestObject2();

I am getting an error:

Line: 1, Column: 25
Constructor not defined: [TestObject2].<Constructor>(Integer)

What is wrong here?
trigger AddRelatedRecord on Account (after insert, after update) 
{
  list<opportunity> opplst = new list<opportunity>();
    Map<ID,Account> acctsWithOpps = new Map<ID,Account>([select id,(select id from opportunities) from Account where id IN: Trigger.New]);
    
    for(Account a: Trigger.New)
    {
        if(acctsWithOpps.get(a.Id).Opportunities.Size()==0)
        {
            opplst.add(new opportunity(Name=a.Name + 'opportunity',StageName='Prospecting',CloseDate=System.today().addMonths(1),AccountId=a.Id));
        }
    }
    if(opplst.size()>0)
    {
        insert opplst;
    }
}


User-added image
Hi Folks,

This is more of an FYI post and for those of you who have not noticed it yet. The developer console comments in component markups interers with the SLDS classes with "--" in the class name.

Temporary solution - Change/remove all the "--"'s from the class name in the markup for the code you are trying to comment.

Example:
The below code cannot be commented with <!-- code -->
<div class="slds-spinner--inverse slds-spinner slds-spinner--large" aria-hidden="false" role="alert">
You will need to remove the "--" from the class name inorder for the comment to work in dev console.
<!-- changed "--inverse" to "-inverse" and "--large" to "-large"
  <div class="slds-spinner-inverse slds-spinner slds-spinner-large" aria-hidden="false" role="alert">
-->
Cheers!
  • August 31, 2016
  • Like
  • 1
hii friends please suggest me  test class for this  below. i have also written one test class but showing error
Trigger RevenueWithoutST on Revenue__c (before insert,Before Update) {

    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist = new List<Revenue__c>();
    string eCode;
    date salaryDate;
    string category;
    string type;
    Integer month;
    Integer year;
    
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        month=rev.Salary_Processed_Month__c.month();
        year=rev.Salary_Processed_Month__c.year();
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;      
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: ecode] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
               rev.Talent_Name__c= app.Name_of_the_Candidate__c;
               rev.Client_Name__c=app.Client_Name__c;
               rev.DOJ__c=app.Date_of_Onboarding__c;
               rev.Last_Working_Date__c=app.Last_Working_Date__c;
               rev.Location__c=app.Location__c;
            }
        }

        if((eCode!=null) && (category=='individual') &&(salaryDate!=NULL) )
        {
            List<Invoice__c> InvList;                                                                              
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,Sub_Total__c,Invoice_Date__c from Invoice__c where Emp_Code__c=: ecode
                    AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
              System.debug('+++invoice'+InvList);
              
              
                FOR(Invoice__c inc : InvList)
                {
                  
                  rev.Revenue_Without_ST__c=inc.Sub_Total__c;
                }

        }

        else if(eCode!=null && category=='consolidated')
        {

            List<Invoice_Line_Item__c> ILineList;
         // Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c,Invoice_Date__c from Invoice_Line_Item__c where Employee_Code__c=:ecode
                        AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              rev.Revenue_Without_ST__c=IL.Total__c;
            }
        }
           
    }
 
    }
Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }

Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }
 
We have an active community with a visualforce page with the following code:

<apex:page >
<flow:interview name="New_User_Flow"/>
</apex:page>

When you navigate to this page within the community: https://XXX.force.com/New_User_Flow it shows error:

https://XXX.force.com is down for maintenance Sorry for the inconvenience. We'll be back shortly. Please email us if you need to get in touch.

This visualforce page has been added under "Public Access Settings" for the community profile (Community > Admin > Pages > Go to Force.com).

How can we make this page accessible? It should display a flow as per visualforce page.

Hi friends, do you know the code (Apex or Javacript) to open the Salesforce PDF Viewer but with a PDF i created manually? Not the templates you can create with salesforce.

 

cheers

  • October 18, 2012
  • Like
  • 2

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.