Hello, I am trying to check in SC 2.0 if a vendor ...
# suitescript
h
Hello, I am trying to check in SC 2.0 if a vendor record exists for a customer record by trying to load the record with the customer id.
var vendor = record.load({
  
type: record.Type.VENDOR,
   
id: 50390
})
But it gives me "That record does not exist error". Am I checking it the wrong way? Can anyone help me with this?
w
If you know that they are a customer already, you can load the customer and check the otherrelationships field. Alternatively do a lookupfields call on the vendor
h
Thanks. Another one. Am also trying to create a new vendor using
var vendor = record.create({
   
type: record.Type.VENDOR,
   
isDynamic: true
    
});
vendor.setValue('internalid', '50389');
But it is giving me Please enter value(s) for: Primary Subsidiary. Any idea what is this expecting?
w
Unfortunately there is not an API for creating customer relationships. You will either need to have completely separate customers and vendors or use the janky method that is suggested in SuiteAnswers.
h
Ok thanks.