Salesforce API update issue
Hi Smartbear Community!
I'm using the unsupported API github extension for common Salesforce API calls. I ran into an issue trying to edit/update existing ACCOUNT data.
I'm using JS and have created a function I can pass AccountName to, which then pulls the ID, and then does a Salesforce.Account.Get on the Salesforce instance.
function Edit_Account(AccountName)
{
AccountName = aqString.Replace(AccountName,"'","\\'");
let AccountID = Salesforce.Query("SELECT+Id+from+Account+WHERE+Name+=+'" + AccountName + "'");
let AccountObj = Salesforce.Account.Get(AccountID.GetItem(0).Id);
The issue I'm running into is an error posts back after attempting to .Send() the data back to SF. It seems like the .Get call is pulling back a record with a lot of columns which I don't intend to change and when using .Send() I get the following error.
Body:
[{"message":"Account: bad field names on insert/update call: Additional_E_mail__pc, Special_Needs__pc, Custom_Permissions__pc, Lic_Designation__pc, FinServ__ReferredByUser__pc, FinServ__CommunicationPreferences__pc, FinServ__ContactPreference__pc, Business_Phone__pc, Events_Experiences__pc, NAM_ID__pc, Formal_First_Name__pc, FinServ__CustomerTimezone__pc, Flag_for_Deletion__pc, Customize_QPR__pc, FinServ__SourceSystemId__pc, etc.
When I view the object for AccountObj, I see there's a lot of properties listed there that I don't care about. I'm only trying to change 1 property and send it back to SF.
Any advice would be greatly appreciated!
***SOLVED***
Look in the folder where you extracted the Salesforce github files when originally installing the extension for the file: \testcomplete-salesforce-extension-main\src\script.sj
Within the file is code in the this.Update logic which builds a list of fields which are considered "updateable". You can add logic to that list builder to exclude fields from the .Push when the _metadata.fields[i].name contains "__pc", or for any other condition of field names which are throwing errors when trying to perform a .Update call to Salesforce.
For Example:
Changing: if (_metadata.fields[i].updateable)
To: if ((_metadata.fields[i].updateable) && (_metadata.fields[i].name.search("__pc") < 0))
This will allow you to exclude problematic fields.