function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sam AlexSam Alex 

Contact object fields returns NULL

Hi All,

I Have a trigger for Contact Object. It sends a HTTP request to external Host. For this request I want to get the, First Name, Last Name and Account Name of that Contact.

In the Contact Object
1. User Name is a combination of PREFIX, FIRST NAME and LAST NAME. 
2. Contact is added under an Account and I want to get the Name of the Account (which was selected when the Contact creation)

This is my Trigger,

Contact[] cont =;
    for (Contact c :cont){
        myRequestSendingClass.sendRequest(c.Account.Name, c.Name);
I tryied to access the Account name by
And I tried to accress the Contact name (combination) by

But both of them returns NULL.


How can I get these values from the Contact object?

Please Help Me. Thankyou in advance.

Shaijan ThomasShaijan Thomas
1. Put a system.debug inside the for loop to print the contact Id. Open the contact in UI and check the correct contact you are passing
2. use the SOQL and Try 
Set<Id> ConId = new Set<Id>
for (Contact c :
for (Contact CQuery : select id, name, from contact where id in : ConId)
     myRequestSendingClass.sendRequest(CQuery.Account.Name, C.Name);

// why this code is you are not querying on Account.Name.
//Just try

Hello Sam,

What type is your trigger?
Before insert or update?

I think the same thing as Shaijan, try to get the account and the contact Name in quring them with a SOQL query, it will be easiest.

Let me know if this response help you.