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


JohnR Llewellyn ACSJohnR Llewellyn ACS 
We have a VisualForce page/form (embedded flow) that is designed to create a scholarship application for our convention. When running the flow internally, there is no error and the scholarship application is created. When running through the form externally (https://convention.acslaw.org/Student_Convention_Scholarship), the following error occurs and no record (scholarship application) is created.

An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.

The Flow Appliation error email is sent and provides the following for several attempts to fill out the form:

An error occurred at element Create_Student_Convention_Scholarship_Application (FlowRecordCreate).
INSERT --- INSERT FAILED --- ERRORS : (INVALID_CROSS_REFERENCE_KEY) Record Type ID: this ID value isn't valid for the user: 012G0000001QKQHIA4

In the Create Student Convention Scholarship Application flow, the Record Create element includes RecordTypeID = 012G0000001QKQH. This is the Student Convention Scholarship record type in the custom object Application (Application__c).

Here is information received from a flow alert email (I have the full report available):

An error occurred at element Create_Student_Convention_Scholarship_Application (FlowRecordCreate).
INSERT --- INSERT FAILED --- ERRORS : (INVALID_CROSS_REFERENCE_KEY) Record Type ID: this ID value isn't valid for the user: 012G0000001QKQHIA4

RECORD CREATE: Create_Student_Convention_Scholarship_Application
Create one Application__c record where:
Alternate_Email__c = {!Alternate_Email} (shannonportia@gmail.com)
Application_Type__c = Student Convention Scholarship
Cell_Phone_Number__c = {!varCellPhone} (2149493703)
Contact__c = {!varContactID} (003G000002YwQbu)
RecordTypeId = 012G0000001QKQH
SCS_ACS_Career_Goals__c = {!ACSCareerGoals} (Being in ACS leadership has helped me meet progressive lawyers in the ACS network, which I think is indispensable help in today's job search.)
SCS_ACS_Chapter_at_School__c = {!ACSChapteratSchool} (Yes)
SCS_ACS_Value_Most__c = {!What_do_you_value_most_about_ACS} (My law school is relatively conservative. Progressive viewpoints are not welcomed by the student body. The best part of our ACS chapter is simply giving progressive students (however few of us) a platform in a somewhat unfriendly environment.)
SCS_Attend_Previous_Student_Convention__c = null
SCS_Chapter_Activity__c = {!ChapterActivity} (Yes, I am president of the Alabama chapter. I plan all of our events and delegate some responsibilities to the other chapter leaders. I am speakers' point of contact at Alabama.)
SCS_Convention_Arrival_Date__c = {!ConventionArrivalNew} (March 30, 2017)
SCS_Convention_Arrival_Time__c = {!Convention_Arrival_Time_New} (4:30 PM)
SCS_Convention_Departure_Date__c = {!Convention_Departure_Date_New} (April 2, 2017)
SCS_Convention_Departure_Time__c = {!Convention_Departure_Time_New} (6:25 AM)
SCS_Departure_City__c = {!DepartureCityNew} (BHM)
SCS_First_Choice_Package__c = {!FirstChoicePackage} (Scholarship Package B: Travel Costs)
SCS_Gender__c = {!varGender} (Female)
SCS_Hosted_Locally__c = {!HostedLocally} (Yes)
SCS_If_Awarded__c = {!IfAwarded} (Yes)
SCS_Lodging_Dates__c = null
SCS_Lodging_Friends_Family__c = {!FriendsandFamily} (Yes)
SCS_Lodging__c = {!Lodging} (No)
SCS_NGL__c = {!ACSNGL} (I plan to apply to become an NGL)
SCS_Pet_Allergies__c = {!PetAllergy} (None)
SCS_School_Assistance_Type__c = {!SchoolAssistanceType} (N/A)
SCS_School_Assistance__c = {!SchoolAssistance} (Yes)
SCS_Smoke_Bother__c = {!Does_smoking_bother_you} (Yes)
SCS_Smoker__c = {!Smoker} (No)
SCS_Special_Circumstances__c = {!SpecialCircumstances} (None)
SCS_Travel_Scholarship_Type__c = {!TravelScholarshipTypeNew} (Airfare; Driving-mileage reimbursement)
SCS_Traveling_Costs__c = {!TravelingCostsNew} ($400)
School__c = {!varSCID} (a0WG000000DPHTVMA5)
Failed to create record.

Any help would be appreciated.
Best Answer chosen by JohnR Llewellyn ACS
Peter FribergPeter Friberg
Check that the running user/profile has access to that record type with Id = '012G0000001QKQHIA4'. After adding the access rights you will probably be fine :)
Dan GetzDan Getz 
I created a free Developer Edition (DE) account to just get OAuth with Salesforce working. I would like to work on some of the Trailhead lessons, but want to do so in a different environment / org. I've seen that you can have multple DE's, but I can't figure out how to set that up. What am I missing?

Best Answer chosen by Dan Getz
Bryan JamesBryan James
Hi Dan,
The only thing that needs to be different when setting up a second org is the username. You want to register the new dev org using the same email address or another valid one that you can use to activate things like your org and when enabling domains and lightning experience.

You can use this link (https://developer.salesforce.com/signup) (https://developer.salesforce.com/signup) to go and sign up for a new developer org at any time. There is no limit to how many you can have.

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.