+ Start a Discussion
SFDC coderSFDC coder 
hi all,
i need to get the ids of all the contacts associated to an event.
i.e the contacts that we add into the name field.
However,when i query the whoId field,i just get the primary contact id and not all the other assciated contact ids.

can anyone please help?
Best Answer chosen by SFDC coder
Try to query the EventRelation SObject (http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_eventattendee.htm), with "IsWhat = false" and "IsParent = true".
This should work.

May the Force.com be with you!
Roy GunsRoy Guns 
Is it still possible to customize Lookup Dialog Layout in Lightning Experience? Salesforce documentation says you should edit lookup dialog in an objects Search Layouts but that option isn't available anymore in Lightning Experience
Best Answer chosen by Roy Guns
AnkaiahAnkaiah (Salesforce Developers) 
Hi Roy,

In Lightning Experience, use Search Results under the Search Layouts customization setting to change which fields appear in the search results for both global search and lookup search. You aren’t required to separately update Lookup Dialogs.
The ability to modify Lookup Dialog, Tab, List View, and Filter Fields may not be present for all standard objects. For example, all search layout configuration options are not available for the Activity (Task or Events), Service Contracts, and Pricebook Entry objects. Corresponding search layout configuration options for each object are available based on standard application architecture and each object's unique relationships and function with regard to other objects.
User search layout is not customizable for the Classic interface. Customizations will only be reflected for the Lightning interface.

Refer the below help article.

If this helps, Please mark it as best answer.

sukanta Anbu 7sukanta Anbu 7 
This is my LWC 
     <lightning-card title="" icon-name="custom:custom19">
            label="Attach receipt"
    <lightning-record-edit-form object-api-name="DMS__c" onsuccess={handleSuccess} onsubmit ={handleSubmit} >
        <div class="slds-grid">
            <div class="slds-col slds-size_1-of-2">
        <lightning-input-field field-name='Name'></lightning-input-field>
        <lightning-input-field field-name='Version__c'></lightning-input-field>
        <lightning-input-field field-name='Key_Words__c'></lightning-input-field>
        <lightning-input-field field-name='Doc_type__c'></lightning-input-field>
        <lightning-input-field field-name='Description__c'></lightning-input-field>
        <div class="slds-col slds-size_1-of-2">
            <lightning-input-field field-name='Contract_LOB__c'></lightning-input-field>
            <lightning-input-field field-name='Active_Contract__c'></lightning-input-field>
            <lightning-input-field field-name='Competitor_Contract__c'></lightning-input-field>
            <lightning-input-field field-name='Folder__c'></lightning-input-field>
        <div class="slds-clearfix">
            <div class="slds-align_absolute-center">
        <lightning-button class="slds-m-top_small" type="submit" label="Upload"  onclick={showSuccessToast}></lightning-button>
        <lightning-button class="slds-m-top_small" label="Cancel" onclick={allowReset}></lightning-button>

Thefollowing is my .js file
import { LightningElement, api } from 'lwc';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import POST from '@salesforce/apex/docUpload.POST';  
export default class Final extends LightningElement {
    @api recordId;
    get acceptedFormats() {
        return ['.pdf', '.png','.jpg','.jpeg'];
    handleUploadFinished(event) {
        // Get the list of uploaded files
        const uploadedFiles = event.detail.files;
        let uploadedFileNames = '';
        for(let i = 0; i < uploadedFiles.length; i++) {
            uploadedFileNames += uploadedFiles[i].name + ', ';
          var Name = component.get("v.Name");
            var Doc_type__c = component.get("v.Doc_type__c");
            var Active_Contract__c = component.get("v.Active_Contract__c");
            var Competitor_Contract__c = component.get("v.Competitor_Contract__c");
            var Version__c = component.get("v.Version__c");
            var Key_Words__c = component.get("v.Key_Words__c");
            var Folder__c = component.get("v.Folder__c");
            var action = component.get("c.POST");
            action.setParams({ file : uploadedFiles, Name : Name, Doc_type__c : Doc_type__c, Active_Contract__c : Active_Contract__c, Competitor_Contract__c : Competitor_Contract__c, Version__c : Version__c, Key_Words__c : Key_Words__c, Folder__c : Folder__c });
            action.setCallback(this, function(response) {
                var returnValue = response.getReturnValue();
                component.set("v.message", returnValue);
                new ShowToastEvent({
                    title: 'Success',
                    message: uploadedFiles.length + ' Files uploaded Successfully: ' + uploadedFileNames,
                    variant: 'success',
    handleSuccess(event) {
        console.log('onsuccess event ',event.detail.id)
    handleSubmit(event) {
        console.log('onsubmit event Newcomp'+ event.detail.fields);
    showSuccessToast() {
        const evt = new ShowToastEvent({
            title: 'Toast Success',
            message: 'Opearion sucessful',
            variant: 'success',
            mode: 'dismissable'
    allowReset(event) {
        const inputFields = this.template.querySelectorAll(
        if (inputFields) {
            inputFields.forEach(field => {
my apex post callout is given
public with sharing class docUpload {
    public String resBody {get; set;}          
        public static String POST(Blob file, String Name, String Doc_type__c, String Active_Contract__c, String Competitor_Contract__c, String Version__c, String Key_Words__c, String Folder__c) {
            Http h = new Http();
    //    String fileName = 'leads.csv';
            String url = 'https://csv-file-upload.herokuapp.com/leads/' + recordId;
            String separationString = 'da5cbc76-39ba-4f80-8b81-090b82e90cf0';
            String str = file.toString();
       //     String csvBody = EncodingUtil.base64Encode(csvBlob);
            // decode 
            Blob decodedBlob = EncodingUtil.base64Decode(str);
            system.debug('string ==>'+decodedBlob);
            // convert to string
            String result = decodedBlob.toString();
            // assemble the body payload
            String header = '--' + separationString + '\nContent-Disposition: form-data; name="file"; filename="' + fileName + '"\nContent-Type: application/octet-stream\n\n';
            //String body = EncodingUtil.base64Encode(file) + '\n';
            String body = result + '\n';
            String footer = '--' + separationString + '--';
            String bodyPayload = header + body + footer;
            system.debug('PAYLOAD: ' + bodyPayload);
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-Type', 'multipart/form-data; boundary=' + separationString);
            system.debug('REQUEST: ' + req);
            // Send the request, and return a response
            HttpResponse res = h.send(req);
            return res.getBody();

Best Answer chosen by sukanta Anbu 7
David Zhu 🔥David Zhu 🔥
In method handleUploadFinished, you are using Lightning Aura component js in a LWC component.

for example: var Doc_type__c = component.get("v.Doc_type__c");
This is s typical Aura component js code.
for the above line, with LWC, you need to change the followings:

<lightning-input-field field-name='Contract_LOB__c' class='Contract_LOB__c'></lightning-input-field>

in js:
var Doc_type__c = this.template.querySelector('.Doc_type__c');

Lines about calling Apex code is also a typical Aura component js.
var action = component.get("c.POST");

It should be like:
 POST({Name: Name,Doc_type__c:Doc_type__c ,......}).then(() => {
The following formula will calculate the number of working days (inclusive) between 2 dates. A working day is defined as Monday to Friday. Even if the start or end dates are a weekend, these are accommodated.

IF(AND((5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( End_Date__c  -   Start_Date__c ) + 1) < 7)),
((CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( End_Date__c  -  Start_Date__c ) - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0))))

The Start Date and End Date fields are custom in the above example and can be replaced as required. If use of a DateTime field is required then the DATEVALUE function will be required.

I also recommend a simple field validation rule is added to check that the End Date is after the Start Date.
Best Answer chosen by Admin (Salesforce Developers) 

This formula seems to work when calculating bt 2 different days. What about taking into account for same day and returns result shoud be a "0"? My result shows a "5" when I entered 9/10/09 and 9/10/09 for both start and end dates. Is there one formula that can include this possiblity?




Create an Apex class that returns an array (or list) of strings: 
Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

MyApexClass to above Challenge:

public class StringArrayTest {
    public static List<string> generateStringArray(Integer n)
        List<String> myArray = new List<String>();
        for(Integer i=0;i<n;i++)
        return myArray;

It's compile and execute as per requirement in Developer console. But Traihead showing the below error:

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.

Anyhelp would be greatly appreciated. Thanks.
Best Answer chosen by Sattibabu
Carolina Ruiz MedinaCarolina Ruiz Medina
Hi Sattibabu,
Please find below a little fix for your issue.

The problem was the space between Test and the number you had : Test0, Test1.... and what was necessary was Test 0, Test 1, ... 
public class StringArrayTest {
    public static List<String> generateStringArray(Integer n)
        List<String> myArray = new List<String>();
        for(Integer i=0;i<n;i++)
           myArray.add('Test '+i);
        return myArray;

Also I will say that if in the test we pass through a negative value it will create values in the array then maybe for real purposes you would like to validate that.

Hope it it helpful :)

I can't create a quick action to run a flow from an Individual
Is this standard or am I missing something:
Flow mission from picklist
Best Answer chosen by Filikin
Naveen KNNaveen KN
Looks like there is no option for creating an action of type - flow in the Individual object. I can see same behavior in my sandboxes. 

As there is no much documention on this, if you have access to creating a case from your prod instance, please create one.

Hello Everyone,


Does anyone know if its possible to bring the translated value of a Picklist field in a Text Formula Field.


I currently have a status picklist field in Object A. Object B is a detail of Object A and I need to display the value of the status field in Object B.


I need to support multiple languages, however, when using translations the picklist label translates perfectly at the Object A level but the child records of Object B display the original value.


I guess formula fields always retrieve the master labels, is there anyway to get around this in order to get the translated value?


Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 

I think this is an idea for this type of problem faced by another person. You can go and promote the idea and may be in the subsequent releases this may be released as a feature.


The following was the response to such a post:-


I have investigated this request 
and have found that there is no practical
way of returning the translated value in the
formula field using the standard
functionality of Salesforce.

Something you could look into
would be to use a trigger to return
the translated value by incorporating
the function mentioned on this page:



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

Amy Linn-StrosinAmy Linn-Strosin 
I'm trying to complete the Trailhead: Customize a Sales Path for Your Team > Customize Opportunity Stages.  One of the steps is adding the field "Main Competitors" to the Needs Analysis tab in the Path.  I can't find that field as an option.  Oddly, I can't find that as an Opportunity field in any of my orgs.  I tried adding it both as a custom text area and a multi-picklist.  Neither succeeded.  I can't complete the trail because I keep getting an error on that step.

Any ideas what I need to do?
Best Answer chosen by Amy Linn-Strosin
Main Competitor(s) - Label
MainCompetitors__c -  API Name
Text(100) - Field Type
Lakshmi SLakshmi S 
Hi All,

Q). What is a future method ? When we are going to use Future methods? Example program for Future method and Schedulable class for Future method?

Give me reply anyone.....
Best Answer chosen by Lakshmi S
NagendraNagendra (Salesforce Developers) 
Hi Lakshmi Narasimha,

What is Future Method:

A future method runs in the background, asynchronously. You can call a future method for executing long-running operations, such as callouts to external Web services or any operation you'd like to run in its own thread, on its own time.

When to use Future Method:

If you want to make the execution of the apex program to run asynchronously then we make use of future method.When you specify
future , the method executes when Salesforce has available resources. For example, you can use the future annotation when making an asynchronous Web service callout to an external service.

Apex class with Future Method:
public class AccountProcessor 
  public static void countContacts(Set<id> setId) 
      List<Account> lstAccount = [select id,Number_of_Contacts__c , (select id from contacts ) from account where id in :setId ];
      for( Account acc : lstAccount )
          List<Contact> lstCont = acc.contacts ;
          acc.Number_of_Contacts__c = lstCont.size();
      update lstAccount;

Test class for the above:
public class AccountProcessorTest {
    public static testmethod void TestAccountProcessorTest() 
        Account a = new Account();
        a.Name = 'Test Account';
        Insert a;

        Contact cont = New Contact();
        cont.FirstName ='Bob';
        cont.LastName ='Masters';
        cont.AccountId = a.Id;
        Insert cont;
        set<Id> setAccId = new Set<ID>();
        Account ACC = [select Number_of_Contacts__c from Account where id = :a.id LIMIT 1];
        System.assertEquals ( Integer.valueOf(ACC.Number_of_Contacts__c) ,1);

Instead of a Schedulable class, try using a batch class. batch classes can be scheduled using the UI, and can call @future methods.
global class ScheduledDispatcher Implements Schedulable{

    public Interface IScheduleDispached{
        void execute(SchedulableContext sc);

    global void execute(SchedulableContext sc){
        Type targetType = Type.forName('{HANDLERNAME');
        if(targetType != null){
            IScheduleDispached obj = (IScheduleDispached)targetType.newInstance();


public class {HANDLERNAME} implements ScheduledDispatcher.IScheduleDispached {

  public void execute(SchedulableContext sc)

        //Call your Future Method Here


For more information refer to the below link.

Kindly mark my solution as the best answer if it helps you.

Best Regards,
Tom Coffey 4Tom Coffey 4 
Working on Windows 10.  

I've installed Zulu 11.  Proof:

User-added image

I've installed Dataloader 45.0.0

I open Data Loader using the shortcut created during installation.

This screen flashes for a second then disappears:

User-added image

And then nothing happens... no Data Loader.

I've tried reinstalling and restarting but that doesn't help.

Any ideas?
Best Answer chosen by Tom Coffey 4
Alain CabonAlain Cabon
Don't use the programs that you show above if that mimics the dataloader v45 (never, viruses? trojans?)

Here is the good way: 

SALESFORCE: Execute Data Loader => To run the Data Loader GUI, run the command

java -jar target/dataloader-xx.0-uber.jar


dataloader_win.zip :

User-added image

User-added image