Tuesday, March 19, 2019

SuiteScript > Updating a Record of a Specific Entity Type is also Changing a Record of Another Entity Type

Customer notices that using the following snippet, another record with the same internal id but of 'Customer' record type is getting updated as well:

var recPartner = nlapiLoadRecord('partner', 801);
recPartner.setFieldValue('comments', 'Other Relationship Test');
nlapiSubmitRecord(recPartner,null,null);

Looking at the records in the UI, the user would see that they were both updated:

Partner Record (Internal ID: 801)


Customer Record (Internal ID: 801) 


This is not a defect, but an expected behavior when the record is designed as 'Records with Multiple Types' (Answer ID: 9648)

To determine if a record is of multiple types, user must go to that record and look if there's a record type indicated on the 'Other Relationships' field under the Relationships tab.



'Other Relationships' could not be removed, so if this is a behavior that the customer does not want or something that they have just noticed, they must create another record that does not have other relationships. Moving forward, this should be the record that they must refer to in their scripts for updating.

No comments:

Post a Comment