How to find how many users are following a topic in Salesforce?

From EntitySubscription sObject, we can find the number of followers for a specific record.

In case of topic, we have to enter the id of the topic record in the Parent Id to filter.

Sample SOQL:

SELECT Id, ParentId, SubscriberId, Subscriber.Email, Subscriber.name, Parent.Name FROM EntitySubscription WHERE ParentId = 'Id of the Topic'



"Insufficient User Permissions" "You have not been designated as a Marketing Cloud Connector user. Please contact your system administrator."

If you get  "Insufficient User Permissions" "You have not been designated as a Marketing Cloud Connector user. Please contact your system administrator."

1. Enable Marketing Cloud for AppExchange User check box for the Marketing Cloud user.

2. Enable Marketing Cloud for AppExchange Admin User check box for the Marketing Cloud user.


If you don't see the fields in the User detail page, add the fields to the page layout or run the below code to update the user in the developer console

update new User( Id = 'Id of the user', et4ae5_ExactTargetForAppExchangeAdmin__c = true, et4ae5_ExactTargetForAppExchangeUser__c = true);


How to get record id from lighting:recordForm in Salesforce?

Sample Code:

Component:


  1. <aura:component >  
  2.       
  3.     <div class="slds-box slds-theme_default">  
  4.           
  5.         <lightning:recordForm  objectApiName = "Opportunity"  
  6.                                layoutType = "Full"   
  7.                                columns = "2"  
  8.                                onsuccess = "{! c.handleSuccess }"/>  
  9.               
  10.     </div>  
  11.       
  12. </aura:component>  

Component Controller:


  1. ({  
  2.       
  3.     handleSuccess : function(component, event, helper) {  
  4.           
  5.         var params = event.getParams();  
  6.         alert(params.id);  
  7.           
  8.     }  
  9.       
  10. })  

Output:



Roll Up Summary field filters in Salesforce

1. You can’t use long text area, multi-select picklist, Description fields, system fields like Last Activity, cross-object formula fields, and lookup fields in the field column of roll-up summary filters. 

2. Make sure that the filter for your roll-up summary doesn't encounter a formula field that results in “#Error!”. If one of your filter criteria uses a formula field that results in an error, no matches are returned for that filter criterion. For example, your roll-up summary filter is “Formula Field equals 10”. Two records contain errors, and one contains the value “10” in that field. In this case, your summary includes only the record with the value “10.”

How to Set field values on lightning:recordEditForm ?

Sample Code:

Sample.cmp:

  1. <aura:component implements="force:appHostable" >  
  2.       
  3.     <aura:attribute name="AccountId" type="String"/>  
  4.       
  5.     <div class="slds-box slds-theme_default">  
  6.           
  7.         <lightning:input type = "text" value = "{! v.AccountId }" label = "Account Id"/><br/>  
  8.         <lightning:button label = "Create Opportunity" variant = "brand" onclick = "{! c.navigateToNewRecForm }"/>  
  9.       
  10.     </div>  
  11.       
  12. </aura:component>  

SampleController.js:

  1. ({  
  2.   
  3.     navigateToNewRecForm : function(component, event, helper) {  
  4.           
  5.         var evt = $A.get("e.force:navigateToComponent");  
  6.         evt.setParams({  
  7.             componentDef : "c:NewRecordForm",  
  8.             componentAttributes: {      
  9.                   
  10.                 AccountId : component.get("v.AccountId")  
  11.                   
  12.             }  
  13.         });  
  14.         evt.fire();  
  15.           
  16.     }  
  17.       
  18. })  

NewRecordForm.cmp:

  1. <aura:component controller="NewRecordFormController">  
  2.       
  3.     <aura:attribute name="AccountId" type="String"/>  
  4.     <aura:attribute name="AccountRec" type="Account"/>  
  5.       
  6.     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>  
  7.       
  8.     <div class="slds-box slds-theme_default">  
  9.           
  10.         <lightning:recordEditForm  objectApiName = "Opportunity"  
  11.                                    onsuccess = "{! c.handleSuccess }">  
  12.             <lightning:inputField fieldName="Name" value="{! v.AccountRec.Name }"/>  
  13.             <lightning:inputField fieldName="StageName"/>  
  14.             <lightning:inputField fieldName="CloseDate"/>  
  15.             <lightning:inputField fieldName="AccountId" value="{! v.AccountRec.Id }"/>  
  16.           
  17.             <lightning:button class="slds-m-top_small"   
  18.                               variant="brand"   
  19.                               type="submit"   
  20.                               name="Create" label="Update" />  
  21.               
  22.         </lightning:recordEditForm>  
  23.               
  24.     </div>  
  25.       
  26. </aura:component>  

NewRecordFormController.js:

  1. ({  
  2.   
  3.     doInit: function (component, event, helper) {  
  4.           
  5.         var action = component.get('c.getAccount');  
  6.         action.setParams({  
  7.               
  8.             acctId : component.get("v.AccountId")  
  9.               
  10.         });  
  11.         action.setCallback(this, function(response) {  
  12.               
  13.             var state = response.getState();  
  14.             if ( state === 'SUCCESS' && component.isValid() ) {  
  15.                   
  16.                 component.set('v.AccountRec', response.getReturnValue());  
  17.                   
  18.             }   
  19.               
  20.         });  
  21.         $A.enqueueAction(action);  
  22.           
  23.     },  
  24.       
  25.     handleSuccess : function(component, event, helper) {  
  26.           
  27.         var params = event.getParams();  
  28.         alert(params.response.id);  
  29.           
  30.     }  
  31.       
  32. })  

NewRecordFormController.apxc:

  1. public class NewRecordFormController {  
  2.       
  3.     @auraEnabled  
  4.     public static Account getAccount(String acctId) {  
  5.           
  6.         return [ SELECT Id, Name FROM Account WHERE Id =: acctId ];   
  7.           
  8.     }  
  9.   
  10. }  

Output:




How to get record id in lightning:recordEditForm?

Component:


  1. <aura:component >  
  2.       
  3.     <div class="slds-box slds-theme_default">  
  4.           
  5.         <lightning:recordEditForm  objectApiName = "Opportunity"  
  6.                                onsuccess = "{! c.handleSuccess }">  
  7.             <lightning:inputField fieldName="Name" />  
  8.             <lightning:inputField fieldName="StageName" />  
  9.             <lightning:inputField fieldName="CloseDate" />  
  10.             <lightning:inputField fieldName="AccountId" />  
  11.           
  12.             <lightning:button class="slds-m-top_small"   
  13.                               variant="brand"   
  14.                               type="submit"   
  15.                               name="update" label="Update" />  
  16.               
  17.         </lightning:recordEditForm>  
  18.               
  19.     </div>  
  20.       
  21. </aura:component>  

Component Controller:


  1. ({  
  2.       
  3.     handleSuccess : function(component, event, helper) {  
  4.           
  5.         var params = event.getParams();  
  6.         alert(params.response.id);  
  7.           
  8.     }  
  9.       
  10. })  

Output: