0

I created a stdclass() object to upsert into Salesforce. I can upsert other custom objects in this way, but there is one that I can't get to work. Here is the error message that I get

**** Creating the following:
stdClass Object
(
    [created] => 1
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [message] => dealer.ServiceAppointmentControl: execution of BeforeInsert
caused by: System.NullPointerException: Attempt to de-reference a null object (dealer)
                    [statusCode] => CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
                )

        )

    [id] => 
    [success] => 
)

I think (from searching online) that there is a Trigger happening, trying to reference a field that is null in the custom object. What I am searching for is a way to determine which of the fields is requied WITHOUT having to open each one up and look for the required box. I called describeSObject(mycustomobject) and while it did return all of the fields, it did not display whether or not the fields were required. There are like 50 fields and I feel like there must be an easier way.

Thank you for your help and time!

  • 2
    There are apps on the app exchange that can do this, Field Trip, SEED, etc. But they WILL NOT show fields that are required because of poorly written code. The error above is not due to a required field (per se) but is because code was not properly written to account for an empty field. – Eric Aug 26 '15 at 0:15
  • 1
    Additionally, If a field was required at the object level, it would have thrown that error first: Require_Field_Missing – Eric Aug 26 '15 at 1:09
  • Thank you @Eric for telling me about the Require_Field_Missing error - saved me a lot of time. When you say that code was not properly written, do you mean that the trigger was not properly written to check for a missing field? – Mimi Sakarett Aug 26 '15 at 15:14
0

Any time you see the word "exception" in salesforce, it means that an unusual programming bug has asserted itself. There's nothing wrong with your PHP, but there is a problem in your org's code. You'll need to debug this using Debug Logs on the server. The trigger couldn't run because it wasn't designed to handle certain types of missing data.

  • Thank you! So there is no way for me to determine which field is the one at fault here? – Mimi Sakarett Aug 26 '15 at 15:15
  • @MimiSakarett - In a managed package no - you will have to contact the vendor. It may not be a field at all – Eric Aug 26 '15 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.