3

I am working on NetSuite WSDL. I am stuck on this error from past two days. I have searched on the internet but couldn't find a solution.

I try to add a custom field in NetSuite using Python but I am getting the error

zeep.exceptions.Fault: org.xml.sax.SAXException: {urn:core_2017_1.platform.webservices.netsuite.com}CustomFieldRef is an abstract type and cannot be instantiated

Any kind of help would be appretiated. Thanks in advance.

Utkarsh Sharma
  • 323
  • 4
  • 14

2 Answers2

3

I solved the question by using SelectCustomFieldRef instead of CustomFieldRef. i.e.

new_record['companyName']= 'test_clinic1'
new_record['firstName']= 'test_clinic_first_name1'
new_record['altName']= 'test_clinic1'
new_record['lastName']='test_last__clinic_name2'
record = RecordRef(internalId=1, type='subsidiary')
new_record['subsidiary'] = record

customField= SelectCustomFieldRef()
customField.internalId='285'
customField.scriptId='custentity_profile_type'
customField.value={
                'name': 'Clinic',
                'internalId': '2',
                'externalId': None,
                'typeId': '31'
            }

new_record['customFieldList']=CustomFieldList(customField)
Utkarsh Sharma
  • 323
  • 4
  • 14
  • 1
    Just to complete your answer, if the custom field is a String we need to use StringCustomFieldRef instead of SelectCustomFieldRef. Thanks for your question/answer that helped ! – F Blanchet Jan 27 '23 at 08:38
0

The error is pretty much self-explanatory though not helpful unless you already understand it.

If you want to edit/create custom field you have to instantiate the correct type.

e.g. in Java

StringCustomFieldRef strCF = new StringCustomFieldRef();
strCF.setInternalId(cfNSKey);

You can get a list of types in the Netsuite docs

bknights
  • 14,408
  • 2
  • 18
  • 31
  • It would be helpful if you could give a sample code in python. – Utkarsh Sharma Sep 27 '17 at 04:47
  • It would be but I have no idea. The basic concept is that you need to create a concrete type. Java was offered because that is what I have. – bknights Sep 27 '17 at 04:54
  • 1
    Can you provide the link for sandbox NetSuite? – Utkarsh Sharma Sep 27 '17 at 06:13
  • Your explanation is just as short as the error itself, and that link requires a login. Can you provide a summary of the relevant info? – Luke Oct 09 '18 at 15:01
  • I cannot. If you don't have a Netsuite login the info is protected by NDA/License agreements etc. Though my answer is exactly the same as the OP's self answer -- that is to use a concrete type that corresponds to the field type you are trying to access. – bknights Oct 09 '18 at 17:02