+ Start a Discussion
Yasemin Kahraman 4Yasemin Kahraman 4 

Hi, l have been working on "Platform App Builder Certification Maintenance (Winter '21) Get Hands-on With Flow Before-Save Trigger When Certain Record Changes are Made" part and it gives me 
" Whoops, looks like there was a problem. Please try again." error message many times although l tried on new and old sandbox.  Both didnt work. Can somebody help me about it ? thanks in advance. it is important to keep my certification. 
User-added imageUser-added image
Best Answer chosen by Yasemin Kahraman 4
AbhishekAbhishek (Salesforce Developers) 
Your query is answered here,

https://www.youtube.com/watch?v=w_bTHhyobW4


If you still face the issue reach below,

https://trailhead.salesforce.com/en/help?support=home

https://trailhead.salesforce.com/help

So that our trailhead support engineers will look into it and get back to you.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Regards,
​​​​​​​Salesforce Support.
Shavi DabgotraShavi Dabgotra 

Hi Everyone!

I want a list of account using Lightning-datatable. But it is not displaying the list of accounts.
HTML:

<template>
    <lightning-card title="t">
        <template if:true={accList}>
    <lightning-datatable
    key-field="Id"
    data={data}
    columns={columns}>
    </lightning-datatable>
    </template>
    <template if:true={error}>
        {error}
    </template>
</lightning-card>
</template>

JS:

import { LightningElement ,api, wire, track} from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class Test extends LightningElement {
    @track columns = [{
            label: 'Account name',
            fieldName: 'Name',
            type: 'text',
            sortable: true
        },
        {
            label: 'Type',
            fieldName: 'Type',
            type: 'text',
            sortable: true
        },
      
    ];
 
    @track error;
    @track accList ;
    @wire(getAccountList)
    wiredAccounts({
        error,
        data
    }) {
        if (data) {
            this.accList = data;
            alert(JSON.stringify(accList));
            alert(JSON.stringify(data));
        } else if (error) {
            this.error = error;
        }
    }
}

Apex Class: 

public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account LIMIT 10];
    }
}

xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>50.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        
            <target>lightning__AppPage</target>
            <target>lightning__RecordPage</target>
            <target>lightning__HomePage</target>
        
    </targets>
</LightningComponentBundle>

Output: 

User-added image

I want the list of accounts.

Thank you in Advance!

Best Answer chosen by Shavi Dabgotra
CharuDuttCharuDutt
Hii Shavi Dabgotra
Just Copy Paste The Following Code
<template>
    <lightning-card title='Data-Table'>
       
    <div style="height: 300px;">
        <lightning-datatable
                key-field="id"
                data={data}
                columns={columns}>
        </lightning-datatable>
        <div>{error}</div>
    </div>
</lightning-card>    
</template>
 ---------------------------------------------------------------
 js 
import { LightningElement,wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
const columns = [{ label: 'Account name',fieldName: 'Name',type: 'text',sortable: true},
                 {label: 'Type',fieldName: 'Type',type: 'text',sortable: true}];
export default class Test extends LightningElement {
    data = [];
    columns = columns;
    wiredActivities;
    records = '';
    error;

    @wire(getAccountList,{
        }
    )
    wiredCases(value){
        this.wiredActivities = value;
        const { data, error } = value;
    
    if(data){
        let dataEditing = JSON.parse(JSON.stringify(data));
        this.records = dataEditing.length;
        this.data = dataEditing;
        
    }else if(error){
        this.error = error;
    }
    
}
}
Please Mark It As Best Answer If it Helps
Thank you
 
Ranjith DevRanjith Dev 
Hi Team,

I have a lightning Component that used the access="global". Salesforce has suggested please remove the access="global" in all lightning components.
User-added image
but when I remove the access="global", the package got not Upload it showing an error message.
User-added image
any suggestion that would be helpful for me.

Thank you.
Ranjith M
Best Answer chosen by Ranjith Dev
SwethaSwetha (Salesforce Developers) 
HI Ranjith,
The error is probably related to the scenario explained in https://salesforce.stackexchange.com/questions/307758/component-is-from-a-managed-package-and-must-be-marked-access-global-on-sfd

If you are releasing a component as part of a package, then you definitely want your component to be accessible outside of your org, for which you would need to mark it with a global access.

See related: https://salesforce.stackexchange.com/questions/219001/lightning-component-in-this-managed-package-must-be-marked-access-global
https://salesforce.stackexchange.com/questions/176948/when-to-set-lightning-access-global-in-managed-packages

If this information helps, please mark the answer as best.Thank you
Developer BaseDeveloper Base 
Hello,

could anyone explain what are those so called Application Programming Interfaces? And why do we have so many of them? We have Streaming API, SOAP API, Metadata API and so many more.

Are APIs some sort of collections of classes and methods that can be used for a certain purpose?

And why is there so many of them when only one would be enough, containing all the methods?
Best Answer chosen by Developer Base
ANUTEJANUTEJ (Salesforce Developers) 
Hi there,

>> https://focusonforce.com/integration-and-data-loading/an-introduction-to-salesforce-apis/#:~:text=API%20stands%20for%20Application%20Program,a%20simple%20and%20secure%20manner. 

As stated in the above link "Salesforce provides programmatic access to your organization’s information using simple, powerful, and secure application programming interfaces[API's]."

There are many API's depending on the functionality we want to perform we choose the API and extend the functionality as per the requirement, below are list of API's that are provided by Salesforce:

REST API - Access objects in your organization using REST.
SOAP API - Integrate your organization’s data with other applications using SOAP.
Tooling API - Build custom development tools for Force.com applications. Coming soon!
Chatter REST API - Access Chatter feeds and social data such as users, groups, followers, and files using REST.
Bulk API - Load or delete large numbers of records.
Metadata API - Manage customizations in your org and build tools that manage the metadata model (not the data, itself).
Streaming API - Provide a stream of data reflecting data changes in your organization.
Apex REST API - Build your own REST API in Apex. This API exposes Apex classes as RESTful Web services.
Apex SOAP API - Create custom SOAP Web services in Apex. This API exposes Apex classes as SOAP Web services.
Data.com API - Data.com provides 100% complete, high quality data, updated in real-time in the cloud, and with comprehensive coverage worldwide.

>> https://help.salesforce.com/articleView?id=sf.integrate_what_is_api.htm&type=5

The above link gives an explanation of when to use which API along with the list of API's.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Cristian WhiteCristian White 

Hi, how can I cover these remaining lines for this class? I'm struggling to understand why it is not covering all.. This is my class and coverage, I have 66% until now.

User-added image
This is my method from the test class which covers 66%.

 

static testMethod void linkTest() {

        
       	SVMXC__Service_Request__c sr = new SVMXC__Service_Request__c();
        sr.SVMXC__Status__c = 'Closed';
        sr.SVMXC__Priority__c = 'Medium';
        sr.Number_of_Open_Admin_Tasks__c = 2;
        sr.SVMXC__Type__c = 'Complaint CCM';
        insert sr;
        
    	List<SVMXC__Service_Request__c> listSr = [Select Id, SVMXC__Status__c, Name from SVMXC__Service_Request__c where Id=: sr.Id ];
    	
    	ApexPages.StandardSetController setCtr = new ApexPages.StandardSetController(listSr);
    	setCtr.setSelected(new SVMXC__Service_Request__c[]{sr});
        MassUpdateSimpleControllerServiceRequest controller = new MassUpdateSimpleControllerServiceRequest(setCtr);
		
		// verify following exceptions will not cause exception
		System.assert(controller.step1()!=null);   
        controller.lexstep1();
		System.assert(controller.step2()!=null);
        controller.lexstep2();
        controller.getFieldTypeOptions();
		System.assert(controller.step3()!=null);
        controller.lexstep3();
		System.assert(controller.step4()!=null);
        controller.lexstep4();
		System.assert(controller.step5()!=null);
        controller.lexstep5();
		//System.assert(controller.cancel()!=null);
		
	
    }
Best Answer chosen by Cristian White
leonardokipperleonardokipper
static testMethod void massUpdate() {
        Account acc = new Account();
        acc.Name = 'ABC Labs';
        insert acc;
        List<Account> accLst = new List<Account>{acc};
        Test.startTest();
            String value = 'This is my test desciption';
            new MassUpdater(accLst, Account.Description, value).massUpdate();
            //ToDo assert ApexPages.Message success message
            //System.assertEquals('Updated '+accLst.size()+ ' Records', new MassUpdater(accLst, Account.Description, value).massUpdate().getSummary());
            System.assertEquals(value, [SELECT Description FROM Account WHERE Id = :acc.Id].Description);
            new MassUpdater(accLst, Account.Name, '').massUpdate();
            //ToDo assert ApexPages.Message
            //System.assertEquals('Updated '+accLst.size()+ ' Records', new MassUpdater(accLst, Account.Description, '').massUpdate().getSummary());
            System.assertNotEquals('', [SELECT Name FROM Account WHERE Id = :acc.Id].Name);
        Test.stopTest();
    }

 
Connie W 5Connie W 5 
my requirement is to create a report and track service appointmnet in field service.
Best Answer chosen by Connie W 5
VinayVinay (Salesforce Developers) 
Hi Connie,

Unfortunately, this feature is currently unavailable.  Kindly review below Idea link and vote for this feature.

https://trailblazer.salesforce.com/ideaView?id=0873A000000lPD8QAM

If you are looking for service reports check below reference.

https://help.salesforce.com/articleView?id=sf.fs_create_customer_reports.htm&type=5

Thanks,
Developer BaseDeveloper Base 
Hey, I am studying for developer II cert and I ran into a peculiar thing.

my test class does NOT trigger mixed DML error, although I am inserting setup and non-setup objects. Why not? My code:
 
@isTest
public class UpdateAccountNameTest {
    @isTest
    public static void test1(){
        Profile prfl = [Select Id, Name from Profile where name ='System Administrator'];
        
        Account acc = new Account();
        acc.Name = 'test';
        insert acc;
        
        Custom_Object1__c a = new Custom_Object1__c();
        a.Name = 'testAccount';
        insert a;
        
        User usr2 = new User();
        usr2.LastName = 'setup1';
        usr2.Username = 'test1@test123.net';
        usr2.Email = 'tes1t@test123.net';
        usr2.Alias = 'Test1';
        usr2.CommunityNickname = 'Test1';
        usr2.TimeZoneSidKey = 'Europe/Prague';
        usr2.LocaleSidKey = 'cs_CZ';
        usr2.EmailEncodingKey = 'UTF-8';
        usr2.ProfileId = prfl.Id;
        usr2.LanguageLocaleKey = 'en_US';
        usr2.IsActive = true;
        insert usr2;     
    }
}

 
Best Answer chosen by Developer Base
Developer BaseDeveloper Base
So for some reason when creating a User record, if I do not create record with UserRoleId field, it wont trigger Mixed DML Error. That is the reason.
Jonathan Wolff 7Jonathan Wolff 7 
Hi, I'd like to build a chatter component that displays the title and author of the last 5 messages only. Can you give me a code example how to do it?
Best Answer chosen by Jonathan Wolff 7
AnudeepAnudeep (Salesforce Developers) 
Hi Jonathan, 

I believe this is possible and you'd need to target FeedComment as per the diagram shown on the below page 

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_erd_chatter.htm

Below is the link to the Developers Guide on the Objects stored under each Feed Object for example Account_Feed etc

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_associated_objects_feed.htm

You can look at the sample chatter component here as well 

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you

 
Shavi DabgotraShavi Dabgotra 

Hi,
I have created a drop down menu in lightning web component. But, I want a pop up will appear on click of a menu item. 
I tried this for pop up, But it is not working. On click of a "Rename " Menu item . A pop up will be shown.

button.html

<template>
    <div class="slds-p-around_medium lgc-bg">
        {selectedItemValue}
        {ready}
        <lightning-card title="Drop Down">
            <lightning-button-menu alternative-text="Show menu" variant="border-filled" onselect={handleOnselect}>
                {selectedItemValue}
                <lightning-menu-item value="openinsharepoint" label="Open in SharePoint" prefix-icon-name="utility:new_window"
                    href="#"
                    target="_blank">
                </lightning-menu-item>
                <lightning-menu-item value="rename" label="Rename" prefix-icon-name="utility:edit">
                    <template if:true={ready}>
                        <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_small"
                            aria-labelledby="modal-heading-01" aria-modal="true" aria-hidden="true"
                            aria-describedby="modal-content-id-1">
                            <div class="slds-modal__container">
                                <!-- Modal/Popup Box LWC header here -->
                                <header class="slds-modal__header">
                                    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeModal}>
                                        <lightning-icon icon-name="utility:close"
                                            alternative-text="close"
                                            variant="inverse"
                                            size="small" ></lightning-icon>
                                        <span class="slds-assistive-text">Close</span>
                                    </button>
                                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Rename LWC Setup.docx</h2>
                                </header>
                                <!-- Modal/Popup Box LWC body starts here -->
                                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                                    <lightning-input type="text" name="folder_name" label="Rename" placeholder="Enter new item name">
                                    </lightning-input>
                                </div>
                                <!-- Modal/Popup Box LWC footer starts here -->
                                <footer class="slds-modal__footer">
                                    <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel">Cancel</button>
                                    <button class="slds-button slds-button_brand" onclick={submitDetails} title="Create">Create</button>
                                </footer>
                            </div>
                        </section>
                        <div class="slds-backdrop slds-backdrop_open"></div>
                    </template>
                </lightning-menu-item>
                <lightning-menu-item value="download" label="Download" prefix-icon-name="utility:download">
                </lightning-menu-item>
                <div class="slds-has-divider_top-space" role="separator">
                    <lightning-menu-item value="delete" label="Delet" prefix-icon-name="utility:close"></lightning-menu-item>
                </div>
            </lightning-button-menu>
        </lightning-card>
    </div>
</template>

button.js

import { LightningElement, track } from 'lwc';
export default class ButtonMenuOnselect extends LightningElement {
    @track selectedItemValue;
    @track ready;
    handleOnselect(event) {
        this.selectedItemValue = event.detail.value;
        if(this.selectedItemValue == "rename")
        {
        alert("ready");
        this.ready = true;
        alert("false");
        }
        
    }
}

 

Best Answer chosen by Shavi Dabgotra
CharuDuttCharuDutt
Hii Shavi Dabgotra
Just Copy Paste  The following code
<template>
  <div class="slds-p-around_medium lgc-bg">
    {selectedItemValue} {ready}
    <lightning-card title="Drop Down">
      <lightning-button-menu
        alternative-text="Show menu"
        variant="border-filled"
        onselect={handleOnselect}
      >
        {selectedItemValue}
        <lightning-menu-item
          value="openinsharepoint"
          label="Open in SharePoint"
          prefix-icon-name="utility:new_window"
          href="#"
          target="_blank"
        >
        </lightning-menu-item>
        <lightning-menu-item
          value="rename"
          label="Rename"
          prefix-icon-name="utility:edit"
        >
        </lightning-menu-item>
        <lightning-menu-item
          value="download"
          label="Download"
          prefix-icon-name="utility:download"
        >
        </lightning-menu-item>
        <div class="slds-has-divider_top-space" role="separator">
          <lightning-menu-item
            value="delete"
            label="Delet"
            prefix-icon-name="utility:close"
          ></lightning-menu-item>
        </div>
      </lightning-button-menu>
      <template if:true={ready}>
        <div class="slds-box slds-theme_shade">
          <div class="slds-modal slds-fade-in-open slds-backdrop">
            <div class="slds-modal__container">
              <!--HEADER Section-->

              <div class="slds-modal__header">
                <lightning-button-icon
                  icon-name="utility:close"
                  alternative-text="Close this window"
                  size="large"
                  variant="bare-inverse"
                  onclick={closeModal}
                  class="slds-modal__close"
                >
                </lightning-button-icon>
                <h2>Rename LWC Setup.docx</h2>
              </div>
              <!---Body Section-->
              <div class="slds-modal__content slds-p-around_medium">
                <lightning-input
                  type="text"
                  name="folder_name"
                  label="Rename"
                  placeholder="Enter new item name"
                >
                </lightning-input>
              </div>
              <!--Footer Section-->
              <div class="slds-modal__footer">
                <button
                  class="slds-button slds-button_neutral"
                  onclick={closeModal}
                  title="Cancel"
                >
                  Cancel
                </button>
                <button
                  class="slds-button slds-button_brand"
                  onclick={submitDetails}
                  title="Create"
                >
                  Create
                </button>
              </div>
            </div>
          </div>
        </div>
      </template>
    </lightning-card>
  </div>
</template>





---------------------------------------------------------------------------------------------------

js



 @track selectedItemValue;
    ready = true;
    handleOnselect(event) {
        this.selectedItemValue = event.detail.value;
        alert(this.selectedItemValue);
        if(this.selectedItemValue == 'rename')
        {
        this.ready = true;
        }
        
    }
    closeModal(){
        this.ready = false;
    }

Please Mark It As Best Answer If it Helps Thank you
Admin User 10568Admin User 10568 
Hi, 

Hoping someone could help me out.

I have the following apex class: 

public class PriceListAscending{
private String sortOrder = 'REPRO__Project_Name__c';
public list<REPRO__Project__c> getEvents() {
    list<REPRO__Project__c> results = Database.query(
        ' SELECT REPRO__Project_Name__c, REPRO__Properties__r.REPRO__Property__c, REPRO__Properties__r.REPRO__City__c, REPRO__Properties__r.Property_Level__c, REPRO__Properties__r.Price_List_Property_Name__c, REPRO__Properties__r.REPRO__Type__c,REPRO__Properties__r.REPRO__Bdr__c,REPRO__Properties__r.REPRO__Bth__c,REPRO__Properties__r.REPRO__Study__c,REPRO__Properties__r.REPRO__Internal_Size__c,REPRO__Properties__r.REPRO__External_Size__c, REPRO__Properties_r.REPRO__Car_c, REPRO__Properties__r.REPRO__List_Price__c, REPRO__Properties__r.REPRO__Status_c ' + 
        ' FROM REPRO__Project__c'  + 
        ' ORDER BY ' + sortOrder + ' ASC '
    );
    return results;
}
}

There is no error displayed in the editor. 

When I try to call the fields from a pageblocktable for my visual page, I get the following error: Invalid field Property_Level__c for SObject REPRO__Project__c

Here is an example of the call: 

<apex:pageBlockTable value="{!Events}" var="e" align="center" cellpadding="2" border="4"  style=" font-weight: bold; text-align: center" >
  <apex:column value="{!e.Property_Level__c}" style="padding: 10px;order-bottom: 1px solid #ddd;border: 1px solid black; text-align: center; " />

Any help would be greatly appreciated.
 
Best Answer chosen by Admin User 10568
AnudeepAnudeep (Salesforce Developers) 
This is a child to parent SOQL. Can you please check if you have a field named Property_Level__c on the object REPRO__Properties__c
 
REPRO__Properties__r.Property_Level__c

See example below

Traverse multiple level upwards

There is a custom lookup field on contact object called Best Friend and there is a field called likes ice cream. Write a query to retrieve the custom field
 
SELECT Id, Best_Friend__r.Likes_Ice_Cream__c FROM contact

Here we’re traversing a custom lookup field Best_Friend__c on the contact object. Notice how the “__c” changes to a “__r” when traversing that field!