+ Start a Discussion
fiona gentryfiona gentry 
Created a new Custom object ,now i want to create this Custom Object as Tab in the App ,but when i create a "Lightning App",can't see the Custom object in Navigation Items,I checked in profiles as well ,i had full access to the custom object as i am salesforce admin

User-added image
Your help is highly appreciated

Best Answer chosen by fiona gentry
mukesh guptamukesh gupta
Hi Fiona,

First you need to create a tab for object, steps are given below :

Go to setup->App Setup->Create->Tabs->Click on New button
Now you are able to add this tab to application, steps are given below :
Go to setup-> App Setup-> Create-> Apps-> Click on your application->click on edit button-> select & add your tab

if you need any assistanse, Please let me know!!

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



How can I access the first element in a set?  Example in a list, you can use this to get the first element in the list  


Integer x = xList.get(0);


What would be a quick equivalent way of doing this in a set?

Best Answer chosen by Admin (Salesforce Developers) 
string firstElement = null;
for (string setElement : setElements) {
        firstElement = setElement;

 This would be (marginally) faster, since you break early.


You can also:


string firstelement =
 (new list<string>(setelements) )[0] );

 Just make sure setElements.isEmpty() is false.

Hi, I wrote a trigger and a test class, but when testing I get below error: 

System.DmlException: Update failed. First exception on row 0 with id 003M000000Zc1NaIAJ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, PopulateContactAreaCode: execution of BeforeUpdate
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.PopulateContactAreaCode: line 5, column 1: []

trigger PopulateContactAreaCode on Contact (before insert, before update) {

    for(Contact contact : Trigger.new)
        string AreaCode = CountryRegion__c.getInstance(contact.MailingCountry).Area_Code__c;
        contact.Area_Code__c = AreaCode;

test class:
public class PopulateContactAreaCodeTest
    static testMethod void attTriggerTest1()
        Account acct = new Account(id = '001M000000iLhTL', Name = 'Test Account ', Mailing_Country__c = 'Afghanistan');
        update acct;      
        Contact con = new Contact(id = '003M000000Zc1Na', LastName = 'Test Contact', Account = acct, Email = 'test@test.com', Mailing_Country__c = 'Afghanistan', MailingCountry = 'Afghanistan');
        update con;
        delete con;

any idea what I added wrong?

thank you in advance
Best Answer chosen by SFTerr
James LoghryJames Loghry

Because you're running a unit test, it doesn't see any data, and therefore no custom settings exist.  You'll need to insert the custom setting before you insert the Contact record.  Here's an example:

static testMethod void attTriggerTest1()
        insert new CountryRegion__c(Name='Afghanistan',Area_Code__c='123');

        Account acct = new Account(id = '001M000000iLhTL', Name = 'Test Account ', Mailing_Country__c = 'Afghanistan');
        update acct;     
        Contact con = new Contact(id = '003M000000Zc1Na', LastName = 'Test Contact', Account = acct, Email = 'test@test.com', Mailing_Country__c = 'Afghanistan', MailingCountry = 'Afghanistan');
        update con;
        delete con;
Carlos Manuel Lozano SotoCarlos Manuel Lozano Soto 

Hi guys,
¿How can I parse a string json with a complex attribute name "_id"?

I'm trying to parse the next json:


[{"_id":"55d66226726b611100aaf741","replacement":false,"quantity":5,"name":"Generator 1000 kW","maintenanceperiod":365,"lifespan":120,"cost":5000,"sku":"100003"},{"_id":"55d66226726b611100aaf742","replacement":true,"quantity":183,"name":"Cooling Fan","maintenanceperiod":0,"lifespan":0,"cost":300,"sku":"100004"}]
The Class that I created is:
public class Equipment {
    public final String id;
    public final Boolean replacement;
    public final Integer quantity;
    public final String name;
    public final Integer maintenanceperiod;
    public final Integer lifespan;
    public final Integer cost;
    public final Integer sku;

    public Equipment(String id, Boolean replacement, Integer quantity, String name, Integer maintenanceperiod, Integer lifespan, Integer cost, Integer sku) {
        this.id = id;
        this.replacement = replacement;
        this.quantity = quantity;
        this.name = name;
        this.maintenanceperiod = maintenanceperiod;
        this.lifespan = lifespan;
        this.cost = cost;
        this.sku = sku;

But I'm having troubles to parse _id from origin string json to Apex code.
System.assertEquals('55d66226726b611100aaf741', equipments.get(0).id);

When I try to get the id, only I can obtain null value.

Thanks for your time.
Best Regards, 
Carlos Lozano.

Best Answer chosen by Carlos Manuel Lozano Soto
Carlos Manuel Lozano SotoCarlos Manuel Lozano Soto
As a result, I was applying the next code to replace "_id" for "id", but I think there must be a better solution.
public static List<Equipment> jsonToListEquipment(String stringJson){
        String replaced = stringJson.replaceAll('\"_id\"', '\"id\"');
        return (List<Equipment>) JSON.deserialize(replaced, List<Equipment>.class);

I've created a below validation rule on Account, but it's not firing when the length of the Account number is not 8, record getting saved even length is 5 number. What wrong I'm doing ??

LEN(AccountNumber) <> 8
Best Answer chosen by Abhi92
Replace AND with OR.

Your formula should be:

LEN(AccountNumber) <> 8
Christopher Bahr 4Christopher Bahr 4 
I'm looking through my event logs for calls to soon to be deprecated API versions. I have a list of calls and it shows the CONNECTED_APP_ID making these calls. How do I find the Connected App in my system that has that ID?
Best Answer chosen by Christopher Bahr 4
Mahesh SMahesh S

Hello Christopher, 

you can query the Connected Application so that can see the list of application

use this query below
SELECT Id, Name FROM ConnectedApplication 

Mark as Best Answer if it helps. 



Stephanie Wong 51Stephanie Wong 51 
Hi everyone,

I recently hid a custom button from Lightning and enabled it back again in the page layouts. But it does not show in Lightning, but works fine in Classic. What should I do it make it visible again?
User-added image
Best Answer chosen by Stephanie Wong 51
Stephanie Wong 51Stephanie Wong 51
Hi Abhishek,

Thanks for looking into this for me. I checked all the links you sent and that really did not solve the problem. I did find the solution though. It slipped my mind that for Lightning you would add it in the "Salesforce Mobile and Lightning Experience Actions" and for Classic it is in "Custom Buttons".

User-added image
Sohan ShirodkarSohan Shirodkar 
I have used case-assignment rules to assign cases automatically to the right user/queue based on certain conditions. 

Recently I was going through Trailhead content on omni-channel and various routing mechanisms (skill based, queue based). Following statement from trailhead confuses me : "Omni-Channel always assigns cases to the right support agents, and customers are happy with customer service. ".

If we already have case-assignment rules in place, why do we need omni-channel queue based routing? How are the two things different?
Best Answer chosen by Sohan Shirodkar
SwethaSwetha (Salesforce Developers) 
HI Sohan,

A case assignment rule in Salesforce.com is really a grouping of rules that will help you automatically assign cases throughout your support organization based on criteria captured on the case records. Each assignment rule can have multiple rule entries.

In Omni-Channel, work items are automatically routed or “pushed” to agents who are assigned to the appropriate queue. Incoming work items are routed to the agent with the least amount of open work. When work items all consume 1 capacity, the agent with the lowest number of work items receives incoming work.

Kindly 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.

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.