Posts

How to get id from div using onclick in lightning component

Component <div data-account-id="{! account.Id }"  onclick="{! c.selectAccount }">click me</div> Controller selectAccount:  function (cmp, event, helper) {         var id = event.currentTarget.dataset.accountId;         console.log(id); }

How to solve Key hash xxxxxxxxxxx= does not match any stored key hashes

This is how i solved this problem Downloaded your APK to your PC in java jdk\bin folder C:\Program Files\Java\jdk1.7.0_79\bin go to java jdk\bin folder and run cmd then copy the following command in your cmd keytool -list -printcert -jarfile apkname.apk Copy the SHA1 value to your clip board like this CD:A1:EA:A3:5C:5C:68:FB:FA:0A:6B:E5:5A:72:64:DD:26:8D:44:84 and open http://tomeko.net/online_tools/hex_to_base64.php 1.2k to convert your SHA1 value to base64. This is what Facebook requires get zaHqo1xcaPv6CmvlWnJk3SaNRIQ= as our keyhash.

Get Id from current page in Lightning Component

Image
1. Get Id from current page 1.1 Add 'force:hasRecordId' to implements <aura:component implements="force:hasRecordId"> 1.2 Create attribute to receive Id <aura:attribute name="recordId" type="Id" /> 1.3 In controller js component.get("v.recordId");

How to render Visualforce page to PDF then Download it.

7. How to render Visualforce page to PDF then Download it. 1. You need to have two page first page is main page <apex:page id="MainPage" showHeader="false" cache="true" contentType="application/x-pdf#PDF_Name.pdf" <apex:include pageName="SecondpageName"/> </apex:page> 2. your second page <apex:page renderAs="pdf" >//your code</apex:page>

Dynamic SOQL

Image
url source : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_soql.htm

Query in Loop problem: ( we do not need to to select query in loop )

4. Query in Loop problem: ( we do not need to to select query in loop ) resolved: In Apex Class: public class UpdateAccTriggerHandler { public void handleBeforeCreateUpdate( List<Account> newAccList ){ Set<Id> accountGroupIds = new Set<Id>();       for( Account iAccount : newAccList ) {             if(iAccount.Group__c != null ) {                 accountGroupIds.add( iAccount.Group__c );             }         } List<Account> accountGroups = [ SELECT Id, Name, OwnerId                                   From Account                                   WHERE Id in: accountGroupIds                     ...

Call Method from trigger to apex

3. Call Method from trigger to apex and with list<Account> and Map<Id,Account> In Apex class: public class UpdateAccTriggerHandler { public void updateAccountTest(List<Account> newAccList, Map<Id,Account> oldMap){ for(Account acc:newAccList){ //your code... } } } In Trigger : UpdateAccTriggerHandler updateAcc = new UpdateAccTriggerHandler (); updateAcc .updateAccountTest(Trigger.New, Trigger.oldMap);