Hi all, I am transforming Customers to Vendors on...
# suitescript
m
Hi all, I am transforming Customers to Vendors on submitting new Customers, but want also to update the Vendor when the Customer gets updated. Is there a standard way to do this? I tried an aggressive way, to delete the Vendor then transform again, but if the vendor had transactions, NS complains. Thought about getting the fields and their values, then assigning them to the Vendor, but it contains a lot of strange fields.
Copy code
{
  "parent": "",
  "_eml_nkey_": "7387611_SB1~713~3~N",
  "startdate": "",
  "customwhence": "",
  "password": "",
  "custentity_type": "",
  "buyingreason": "",
  "accessrole": "14",
  "entryformquerystring": "stage=CUSTOMER&e=T&id=725",
  "datecreated": "2021-11-28T10:55:00.000Z",
  "receivablesacctpref": "120",
  "version": "120",
  "buyingtimeframe": "",
  "subsidiary": "1",
  "overduebalance": 0,
  "_multibtnstate_": "",
  "billaddr1": "",
  "billaddr2": "",
  "billaddr3": "",
  "selectedtab": "",
  "salesreadiness": "",
  "weblead": "No",
  "nsapiPS": "",
  "isinstallment": "",
  "nsapiPI": "",
  "currency": "1",
  "password2": "",
  "email": "",
  "nsapiPD": "",
  "depositbalance": 0,
  "accesstabchanged": "F",
  "customform": "2",
  "stage": "CUSTOMER",
  "partner": "",
  "sendtransactionsvia": "",
  "origgiveaccess": "F",
  "origcurrency": "1",
  "endbeforestart": "F",
  "nlloc": "0",
  "externalid": "",
  "entityid": "C01861",
  "language": "en",
  "emailpreference": "DEFAULT",
  "nameorig": "C01861",
  "shipcity": "",
  "billattention": "",
  "isindividual": "",
  "contact": "",
  "mobilephone": "",
  "image": "",
  "custentity_cst_name": "",
  "pricelevel": "",
  "hasshippingaddress": false,
  "altphone": "",
  "faxtransactions": false,
  "resalenumber": "",
  "altemail": "",
  "leadsource": "",
  "salutation": "",
  "freeformstatepref": "F",
  "firstname": "",
  "nsapiLI": "",
  "homephone": "",
  "custentity_customer_location": "",
  "vatregnumber": "",
  "edition": "XX",
  "title": "",
  "billzip": "",
  "giveaccess": false,
  "defaultaddressee": "",
  "sys_id": "4391192721292612",
  "shippingcarrier": "nonups",
  "custentity_ph4185_bstyle": "",
  "nldept": "0",
  "nsapiLC": "",
  "custentity_account_number": "",
  "nlrole": "3",
  "middlename": "",
  "_csrf": "WQwJDmXGYsAcqEDjPzd-j9Drqg_k8aVrlPuxs8NB4n2jJ25HYuemYzehewCLpX7LKDmU-oEsf_IukidxGodtAcM5-fZuAejU4N5QIT3nIu9xf0M-y6U267ULujN7FzywYVyQibb7JBInU8uHYYPnQWiKAEx5Mj1Bx22-ZQN-rjM=",
  "shipaddr3": "",
  "shipaddr2": "",
  "shipaddr1": "",
  "billaddressee": "",
  "daysoverdue": "",
  "sendemail": false,
  "creditlimit": "",
  "haschildren": "F",
  "hasshipping": "F",
  "prefccprocessor": "",
  "billcity": "",
  "stagename": "",
  "custentity_english_account_name": "",
  "defaultaddrbook": "",
  "nsapiFC": "",
  "emailtransactions": false,
  "entitynumber": "1861",
  "custentity_bank": "",
  "type": "custjob",
  "billcountry": "",
  "nsapiVF": "",
  "balance": 0,
  "nsapiVD": "",
  "terms": "",
  "nsbrowserenv": "",
  "printoncheckas": "",
  "id": "725",
  "fax": "",
  "nsapiVL": "",
  "nsapiVI": "",
  "custentity_link_lsa": "",
  "taxable": false,
  "wfPS": "",
  "polymorphcontainscreditlimit": true,
  "taxexempt": true,
  "alcoholrecipienttype": "CONSUMER",
  "lastname": "",
  "enddate": "",
  "phone": "",
  "companyname": "Test1",
  "shipping_country": "XX",
  "wfPI": "",
  "defaultaddress": "",
  "taxfractionunit": "2",
  "sourcewebsite": "",
  "initiallyOverrideAllowed": true,
  "creditholdoverride": "AUTO",
  "receivablesaccount": "-10",
  "accesshelp": "",
  "isperson": "F",
  "nluser": "713",
  "wfSR": "",
  "currid": "725",
  "origbinactive": "F",
  "salesrep": "",
  "url": "<https://google.com>",
  "billstate": "",
  "currencyprecision": "2",
  "autoname": "",
  "emailloginkey": "",
  "shipcomplete": false,
  "custentity_date_lsa": "",
  "nlsub": "1",
  "custentity_4601_defaultwitaxcode": "",
  "shipzip": "",
  "origaccessrole": "",
  "wfVF": "",
  "shippingitem": "",
  "defaultbankaccount": "",
  "numberformat": "",
  "nsapiRC": "",
  "isbudgetapproved": false,
  "hasbillingaddress": false,
  "shipstate": "",
  "taxitem": "",
  "unbilledorders": 0,
  "altname": "Test1",
  "isjob": "F",
  "parent_currency": "",
  "defaultorderpriority": "",
  "taxrounding": "OFF",
  "shipattention": "",
  "isinactive": false,
  "sessioncountry": "EG",
  "wfinstances": "",
  "estimatedbudget": "",
  "entitystatus": "13",
  "shipaddressee": "",
  "nsapiCT": "1638101513388",
  "otherrelationships": [
    "725"
  ],
  "negativenumberformat": "",
  "giveaccesschanged": "F",
  "entitytitle": "C01861 Test1",
  "nsapiSR": "",
  "comments": "test",
  "templatestored": "F",
  "accountnumber": "",
  "shipcountry": "",
  "whence": "",
  "reminderdays": "",
  "lastmodifieddate": "2021-11-28T12:11:00.000Z",
  "fillpassword": false,
  "printtransactions": false,
  "baserecordtype": "customer",
  "newaccesshelp": "",
  "custentity_link_name_lsa": "",
  "hasparent": "F",
  "propagateactivity": "F",
  "assignedwebsite": "",
  "monthlyclosing": "31",
  "submitnext_y": "CUSTOMER",
  "wfFC": "",
  "category": "2",
  "submitnext_t": "custjob",
  "territory": ""
}
Do I have to update every field manually?
The fun answer that requires the use of NLAuth no longer works
m
I saw this answer before posting here, it talks about creation, and merging. I am creating the Vendors with no problems, but we need to update them if any update happened to the Customer.
b
thats what the other relationship is for
you make a customer that is also a vendor
m
So it should update automatically?
b
they are the same record
m
But some fields don't get updated
I will check again
Some do and some don't, I guess I will have to check all the fields
b
you wont be able to update vendor specific fields on the customer, same thing other way around
m
Why?
b
general rule of suitescript, dont expect to do things in script that you cant in the ui
m
You can do it in the UI, but manually, update the Customer, then go and update the Vendor
b
correct, you would do the same thing in script
update a customer, and update the vendor
not both at the same time
m
hmm, a little bit strange, but I guess I have to, thanks ❤️
b
if you are trying to update a shared field, then you can rely on the other relationship
m
Company Name
is a required shared field, when you update it, it reflect on
Name
too Updating it on the customer, only updates the
Name
field on the vendor, but it doesn't update itself on the vendor
b
There is specific functionality around the company name regarding autonumbering
they are not actually shared, though you have to allow override of the autonumbering to see that
m
Will check with the functional team. Thanks 🙏