Global API
...
Requests
Contact
Create
1min
to create a contact in netsuite, use action as "createcontact" and pass the contact data in the requestjson under "contacts" note you can only create one record at a time the following is an example of createcontact where we are setting most of the fields (see contact docid 3gjo07daqjxtjeayy3sl9 for all the available fields) the response will return the response back from netsuite, which includes the new netsuite contact id (internalid), plus the newly created salesforce contact id (salesforceid) request // create a map to store all the data of a contact map\<string, object> nscontact = new map\<string, object>(); nscontact put('firstname', 'james'); nscontact put('lastname','williams'); nscontact put('subsidiary', new map\<string, object>{'internalid'=>'1'}); nscontact put('email', 'james\@grandhotel com'); nscontact put('company', new map\<string, object>{'internalid'=>'32342'}); nscontact put('phone', '3453254543'); nscontact put('officephone', '6546564564'); nscontact put('title', 'ceo'); nscontact put('isprivate', true); // initializing the contact custom fields list\<object> concustomfieldlist = new list\<object>(); map\<string, object> concustomfield1 = new map\<string, object>(); concustomfield1 put('fieldtype', 'boolean'); concustomfield1 put('scriptid', 'custentity f3 mm send wf sms'); concustomfield1 put('value', 'true'); concustomfieldlist add(concustomfield1); map\<string, object> concustomfield2 = new map\<string, object>(); concustomfield2 put('fieldtype', 'string'); concustomfield2 put('scriptid', 'custentity alt1 email'); concustomfield2 put('value', 'james12\@gmail com'); concustomfieldlist add(concustomfield2); // adding the contact custom fields nscontact put('customfieldlist', new map\<string, object>{'customfield'=>concustomfieldlist}); // initializing the contact addresses list\<object> addressbooklist = new list\<object>(); map\<string, object> addressbook = new map\<string, object>(); map\<string, object> addressbookaddress = new map\<string, object>(); addressbookaddress put('addr1', 'suite 201'); addressbookaddress put('addr2', '2334 park street avenue'); addressbookaddress put('city', 'chicago'); addressbookaddress put('state', 'il'); addressbookaddress put('country', ' unitedstates'); addressbookaddress put('zip', '60601'); addressbook put('addressbookaddress', addressbookaddress); addressbook put('defaultbilling', true); addressbook put('defaultshipping', true); addressbooklist add(addressbook); nscontact put('addressbooklist', new map\<string, object>{'addressbook'=>addressbooklist}); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('contacts', new list\<object>{nscontact}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createcontact'); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { action=createcontact, timestamp=1607423183079, validrequest=true, version=1 0, responsejson={ "status" "200" "errors" \[], "contacts" \[ { "title" "ceo", "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "salutation" null, "salesforceid" "a022w00000ixl0baad", "publicsubscriptionstatus" null, "phone" "3453254543", "officephone" "6546564564", "nullfieldlist" null, "mobilephone" null, "middlename" null, "lastname" "williams", "lastmodifieddate" 1607423181, "isprivate" true, "isinactive" false, "internalid" "32542", "homephone" null, "firstname" "james", "fax" null, "externalid" null, "entityid" "james williams", "email" "james\@grandhotel com", "defaultaddress" "james williams\nsuite 201\n2334 park street avenue\nchicago il 60601\nunited states", "datecreated" 1607423180, "customform" null, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "true", "scriptid" "custentity f3 mm send wf sms", "internalid" "428", "fieldtype" null }, { "valuelookup" null, "value" "james12\@gmail com", "scriptid" "custentity alt1 email", "internalid" "485", "fieldtype" null } ] }, "company" { "type" null, "name" "cust533at grand hotels & resorts ltd", "internalid" "32342", "externalid" null }, "comments" null, "assistant" null, "altemail" null, "addressbooklist" { "replaceall" null, "addressbook" \[ { "label" "suite 201", "isresidential" null, "internalid" "29889", "defaultshipping" true, "defaultbilling" true, "addressbookaddress" { "zip" "60601", "state" "il", "internalid" null, "country" " unitedstates", "city" "chicago", "attention" null, "addrphone" null, "addressee" "james williams", "addr3" null, "addr2" "2334 park street avenue", "addr1" "suite 201" } } ] } } ] } }