https://netsuiteprofessionals.com logo
w

Will

04/07/2022, 10:45 PM
Does anyone have any experience using SOAP web services with NetSuite? The documentation is not super helpful. Specifically, I'm using the soap package from NPM. https://www.npmjs.com/package/soap
b

battk

04/07/2022, 11:30 PM
you probably want to lead with what part you need help on
w

Will

04/07/2022, 11:32 PM
I guess examples would be helpful. I have a query for posting periods that was working fine previously, but after adding additional subsidiaries on both the employee record and role I am using it now says that I must "provide a value for field subsidiary". I have tried adding it in a few places, but to no avail.
b

battk

04/07/2022, 11:34 PM
its pretty unfriendly on generating a helpful client
it expects that you know how to generate the xml needed for your soap request
w

Will

04/07/2022, 11:44 PM
Yeah, and the NetSuite documentation isn't super helpful in this area.
b

battk

04/07/2022, 11:45 PM
generally help is doing a get operation on an existing record
the record it returns will have all the field elements in the right places
w

Will

04/07/2022, 11:48 PM
I'm trying to do
getSelectValueAsync
, but my request is failing because I'm not providing the subsidiary. I just confirmed that it works fine without the subsidiary if I set my Employee record subsidiary back to what it was originally. I don't know why I'm expected to provide it now. The Posting Periods on the NetSuite site don't appear to be tied to a specific subsidiary.
b

battk

04/07/2022, 11:52 PM
a getSelectValue's fieldDescription element has a filterByValueList element that you need to fill in whenever netsuite would do sourcing/filtering
the example from the docs actually shows an example of using that element
in your case, you would be filtering on the subsidiary set to a specific value
w

Will

04/07/2022, 11:56 PM
I'm not entirely sure that I follow that. My SOAP body that isn't working right now looks like this:
Copy code
<soap:Body>
        <platformMsgs:getSelectValue xmlns:platformMsgs="urn:messages_2018_2.platform.webservices.netsuite.com"
                                     xmlns="urn:messages_2018_2.platform.webservices.netsuite.com">
            <platformMsgs:fieldDescription>
                <platformCore:recordType xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    invoice
                </platformCore:recordType>
                <platformCore:field xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    postingPeriod
                </platformCore:field>
                <platformCore:subsidiary internalId="39"
                                         xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    <platformCore:name>Velocity</platformCore:name>
                </platformCore:subsidiary>
            </platformMsgs:fieldDescription>
            <platformMsgs:pageIndex>0</platformMsgs:pageIndex>
        </platformMsgs:getSelectValue>
    </soap:Body>
b

battk

04/07/2022, 11:59 PM
you are adding a subsidiary element to the fieldDescription
the fieldDescriptions element is a GetSelectValueFieldDescription
it has 7 valid elements you can set in it, none of which is subsidiary
you are adding an invalid element
in the wrong place and in the wrong way
the error is saying you need to filter by the subsidiary field
which is accomplished by setting the filterByValueList element
its not asking you to set the subsidiary element
w

Will

04/08/2022, 12:05 AM
Okay, I think I'm following now. I don't know how there can be a subsidiary field when I can't see one in the UI or NetSuite Field Explorer, but I think this is how the SOAP request should look?
Copy code
<soap:Body>
        <platformMsgs:getSelectValue xmlns:platformMsgs="urn:messages_2018_2.platform.webservices.netsuite.com"
                                     xmlns="urn:messages_2018_2.platform.webservices.netsuite.com">
            <platformMsgs:fieldDescription>
                <platformCore:recordType xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    invoice
                </platformCore:recordType>
                <platformCore:field xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    postingPeriod
                </platformCore:field>
                <platformCore:filterByValueList xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
                    <platformCore:filterBy>
                        <platformCore:field>subsidiary</platformCore:field>
                        <platformCore:internalId>19</platformCore:internalId>
                    </platformCore:filterBy>
                </platformCore:filterByValueList>
            </platformMsgs:fieldDescription>
            <platformMsgs:pageIndex>0</platformMsgs:pageIndex>
        </platformMsgs:getSelectValue>
    </soap:Body>
b

battk

04/08/2022, 12:08 AM
you are getting the select options for the posting period on an invoice
that invoice has a subsidiary field
w

Will

04/08/2022, 12:09 AM
That makes much more sense now.
They can't just use a universal set of options?
b

battk

04/08/2022, 12:10 AM
its the sourcing thing, different options are available to different subsidiaries
w

Will

04/08/2022, 12:10 AM
Because the way our code works now, we get this list first, and then use that list to set the actual posting period for each invoice we're sending to NS.
Well that's going to complicate things.
Is there a way to just get all the Posting Periods, like I would see under Setup > Accounting > Manage Accounting Periods?
b

battk

04/08/2022, 12:19 AM
w

Will

04/08/2022, 12:27 AM
Okay, I'll look into trying that search instead. I ran into another problem though. The search for subsidiary
19
works fine now, but another subsidiary,
39
, that I have set on my Role and Employee record that I have access to is returning
Permission Violation: The restrictions on your role deny you access to this record.
b

battk

04/08/2022, 12:44 AM
same rules as the ui
you can pick whichever subsidiary is selectable in the ui on an invoice
w

Will

04/08/2022, 12:46 AM
Unfortunately I don't know what's selectable because this a new subsidiary we just added, so the only customers using it are ones we've created for testing. I haven't created an invoice yet and I honestly don't know how to manually. We typically just sync data from our proprietary system to do that.
Any idea what setting on the Employee/Role I need to set if I'm missing options that I'm expecting to see?
Or would that be an issue with how invoices for that subsidiary are configured?
b

battk

04/08/2022, 12:57 AM
learn how to make an invoice
w

Will

04/08/2022, 1:10 AM
Good idea. Thank you for all your help. I think a lot of this is really starting to click for me now.
2 Views