I'm trying to test out some functionality with a user event script when a record is created using SuiteTalk SOAP web services in NetSuite. I need to have some values get passed in to some custom fields. However, nothing is getting set to these fields. I have tried using both the "scriptId" and "internalId" attributes in the XML, but nothing seems to work. Not sure what I'm missing. Here's a sample of the XML that I'm passing in:
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<applicationInfo xmlns="urn:messages_2019_2.platform.webservices.netsuite.com">
<applicationId>************************************</applicationId>
</applicationInfo>
<platformMsg:preferences soapenv:mustUnderstand="0" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" xmlns:platformMsg="urn:messages_2019_2.platform.webservices.netsuite.com">
<platformMsg:useConditionalDefaultsOnAdd>true</platformMsg:useConditionalDefaultsOnAdd>
<platformMsg:ignoreReadOnlyFields>true</platformMsg:ignoreReadOnlyFields>
<platformMsg:warningAsError>false</platformMsg:warningAsError>
</platformMsg:preferences>
</soapenv:Header>
<soapenv:Body>
<platformMsg:add xmlns:platformMsg="urn:messages_2019_2.platform.webservices.netsuite.com">
<platformMsg:record xsi:type="ns1:SalesOrder" xmlns:ns1="urn:sales_2019_2.transactions.webservices.netsuite.com" xmlns:ns2="urn:core_2019_2.platform.webservices.netsuite.com" xmlns:ns3="urn:common_2019_2.platform.webservices.netsuite.com">
<ns1:customForm xsi:type="platformCore:RecordRef" internalId="111"/>
<ns1:entity xsi:type="platformCore:RecordRef" internalId="222"/>
<ns1:tranDate>2024-03-01T00:00:00.000+00:00</ns1:tranDate>
<ns1:exchangeRate>1.00</ns1:exchangeRate>
<ns1:shippingAddress>
<ns3:country>_unitedStates</ns3:country>
<ns3:addressee>Johnny Bravo</ns3:addressee>
<ns3:addrPhone>800-555-1234</ns3:addrPhone>
<ns3:addr1>123 Fake St</ns3:addr1>
<ns3:addr2>SUITE 180</ns3:addr2>
<ns3:city>Albuquerque</ns3:city>
<ns3:state>NM</ns3:state>
<ns3:zip>87102</ns3:zip>
</ns1:shippingAddress>
<ns1:paymentMethod xsi:type="platformCore:RecordRef" internalId="5"/>
<ns1:ccNumber>4242424242424242</ns1:ccNumber>
<ns1:ccExpireDate>2025-08-01T12:00:00.000+00:00</ns1:ccExpireDate>
<ns1:getAuth>T</ns1:getAuth>
<ns1:subsidiary xsi:type="platformCore:RecordRef" internalId="1"/>
<ns1:itemList>
<ns1:item>
<ns1:item xsi:type="platformCore:RecordRef" internalId="333"/>
<ns1:quantity>1</ns1:quantity>
<ns1:description>SERVICE FEE</ns1:description>
<ns1:rate>50.00</ns1:rate>
<ns1:line>1</ns1:line>
</ns1:item>
</ns1:itemList>
<ns1:customFieldList>
<ns2:customField xsi:type="ns2:StringCustomFieldRef" scriptId="custbody_custom_field_1" internalId="444">
<ns2:value>ABCDEF</ns2:value>
</ns2:customField>
<ns2:customField xsi:type="ns2:StringCustomFieldRef" scriptId="custbody_custom_field_2" internalId="555">
<ns2:value>123456</ns2:value>
</ns2:customField>
</ns1:customFieldList>
</platformMsg:record>
</platformMsg:add>
</soapenv:Body>
</soapenv:Envelope>
I discovered that the cause of my problem was that the fields needed to be visible on the selected form. The field cannot be hidden by definition, have to marked to be shown on the form, and have to be on a tab that is displayed. Otherwise the fields don't get set, which is quite annoying, especially when you don't want the field to be seen. Had to cover that by using a user event script to hide the fields not to be seen just for the UI.