How to determine whether isPerson is set to Compan...
# ask-stanley-ai
a
How to determine whether isPerson is set to Company or Individual on a supplier record depending on the form ID, prior to the record being loaded/initialised?
c
AI generated answer (using internal Slack threads):
In NetSuite, the
isPerson
field is a checkbox that determines whether a vendor is an individual or a company. However, this field is not directly accessible via SuiteScript. Instead, it is controlled by the
Type
field in the UI, which is a radio button. If the
Type
field is set to mandatory in the form, it can cause issues when trying to load and save the record via script. This is because the
Type
field (which points to
isindividual
) is not defined in SuiteScript. Here's an example of a script that would fail if the
Type
field is set to mandatory:
Copy code
require(['N/record'], function (record) {

let vendor = record.load({
	type: 'vendor',
	id: '[YOUR VENDOR'S ID]',
	isDynamic: true
});
vendor.save({
	ignoreMandatoryFields: false,
	enableSourcing: true
});

})
This script would throw an error saying that
Type
(pointing at
isindividual
) is not defined. To determine whether
isPerson
is set to Company or Individual on a supplier record depending on the form ID, prior to the record being loaded/initialised, you would need to check the
Type
field in the UI. If the
Type
field is set to mandatory, you would need to set the
isindividual
field every time you load and save the record via script. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804522693
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.795025229
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794103682
Please provide your feedback on this answer.