Skip to main content The new Salesforce certifications experience is live! Visit Trailhead Academy to explore your new certifications homepage.
We've done some work to track a user's (web visitor) pageviews and update the user/lead's description field in the API each time users view a new page, with the new pageviews added.

 

 

 

When a new user registers, we receive their Lead object from the Salesforce API.

 

 

 

We then update the description field in the Lead, and post the Lead back to the API with an updated description.

 

 

 

We're noticing we're getting an error in our logs when this occurs ( "INVALID_FIELD_FOR_INSERT_UPDATE" ), and wondering whether you could assist. We think it could be because the description field was previously empty/null, and now we're populating it with content, perhaps? Note that objects in the request/responses from the API are serialized in our logs. I've also highlighted the new description purple in the API request so you can see what we've added

 

 

 

Date: 2018-07-27 10:55:33

 

Lead returned from Salesforce: O:4:"Lead":21:{s:6:"Street";s:19:"18 Roundhouse Court";s:4:"City";s:7:"Preston";s:7:"Company";s:7:"Bespoke";s:7:"Country";s:14:"United Kingdom";s:5:"Email";s:48:"developer+2018-07-27-10-54@bespokedigital.agency";s:9:"FirstName";s:7:"Bespoke";s:8:"Industry";s:12:"10 Aerospace";s:8:"LastName";s:9:"Developer";s:10:"LeadSource";s:24:"PPE Website Registration";s:5:"Phone";s:11:"01772591100";s:10:"PostalCode";s:6:"PR56DA";s:10:"Salutation";N;s:5:"State";s:5:"Lancs";s:12:"fieldsToNull";N;s:11:"Description";N;s:18:"HasOptedOutOfEmail";b:1;s:17:"Opt_in_message__c";s:121:"I’d like to receive news and updates from PPE* * Don’t worry we won’t spam you and you can unsubscribe at any time.";s:19:"Opt_in_date_time__c";s:24:"2018-07-27T10:55:32.000Z";s:17:"Sign_up_Domain__c";s:14:"www.prepol.com";s:2:"Id";s:18:"00Q1r00001EBJ6VEAX";s:9:"Region__c";s:4:"EMEA";}

 

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

 

Date: 2018-07-27 10:55:33

 

Pageviews to post: '\r\nPage \'engineers-hub-login\' viewed.\r\nPage \'about\' viewed.\r\nPage \'management-team-and-history\' viewed.\r\nPage \'engineers-hub-register\' viewed.\r\nPage \'engineers-hub-register\' viewed.\r\n'

 

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

 

Date: 2018-07-27 10:55:33

 

API Request:

 

object(SoapParam)#45 (2) { ["param_name"]=> string(8) "sObjects" ["param_data"]=> array(1) { [0]=> object(SoapVar)#46 (4) { ["enc_type"]=> int(301) ["enc_value"]=> object(Lead)#47 (21) { ["Street"]=> string(19) "18 Roundhouse Court" ["City"]=> string(7) "Preston" ["Company"]=> string(7) "Bespoke" ["Country"]=> string(14) "United Kingdom" ["Email"]=> string(48) "developer+2018-07-27-10-54@bespokedigital.agency" ["FirstName"]=> string(7) "Bespoke" ["Industry"]=> string(12) "10 Aerospace" ["LastName"]=> string(9) "Developer" ["LeadSource"]=> string(24) "PPE Website Registration" ["Phone"]=> string(11) "01772591100" ["PostalCode"]=> string(6) "PR56DA" ["Salutation"]=> NULL ["State"]=> string(5) "Lancs" ["fieldsToNull"]=> NULL ["Description"]=> string(182) " Page 'engineers-hub-login' viewed. Page 'about' viewed. Page 'management-team-and-history' viewed. Page 'engineers-hub-register' viewed. Page 'engineers-hub-register' viewed. " ["HasOptedOutOfEmail"]=> bool(true) ["Opt_in_message__c"]=> string(121) "I’d like to receive news and updates from PPE* * Don’t worry we won’t spam you and you can unsubscribe at any time." ["Opt_in_date_time__c"]=> string(24) "2018-07-27T10:55:32.000Z" ["Sign_up_Domain__c"]=> string(14) "www.prepol.com" ["Id"]=> string(18) "00Q1r00001EBJ6VEAX" ["Region__c"]=> string(4) "EMEA" } ["enc_stype"]=> string(4) "Lead" ["enc_ns"]=> string(30) "urn:enterprise.soap.sforce.com" } } } 

 

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

 

Date: 2018-07-27 10:55:33

 

API Response

 

object(stdClass)#45 (1) { ["result"]=> object(stdClass)#46 (3) { ["errors"]=> object(stdClass)#47 (3) { ["fields"]=> string(9) "Region__c" ["message"]=> string(160) "Unable to create/update fields: Region__c. Please check the security settings of this field and verify that it is read/write for your profile or permission set." ["statusCode"]=> string(31) "INVALID_FIELD_FOR_INSERT_UPDATE" } ["id"]=> NULL ["success"]=> bool(false) } } 

 

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

 

 

 

Any assistance would be much appreciated.  Thanks

 

 
2 answers
Loading
  1. Jul 30, 2018, 11:41 AM
    Hi Donna,

     

    As Parani mentions, the problem you have is with Region.

     

    Am I assuming correctly when I say that field is a picklist? If so, could you examine the list of possible values on it, and ensure EMEA is on that list (capitalized)?
0/9000