Custom Guided Wizard
...
Button URL Structure
URL Fields

Line Items Fields

15min

Populating Line Items from Child Records

It is possible for Breadwinner to populate all of the Line Items of the Sales Order from custom objects, provided a Custom URL Structure is used.

This requires two things: specifying the child object and specifying the fields on that child object to use.

You may iterate over only one Child Object, i.e. you must pick one and only one Related List to iterate over, not two or more related lists. And, as of now, we do not have the ability to iterate over a subset of those child records; you must iterate over all of them or none of them.

Specifying the Child Object

Please note, we do not use the API name of the object, we use the Child Relationship Name. This is because sometimes you will have multiple lookup fields from the child to the parent record, and we won’t know which one to use. Thus, you must specify the child object by using the Child Relationship Name.

The Child Relationship Name can be tricky to find. In setup, go to the child object, and click on the name of the lookup field (or master/child field) to the parent object. If you have two or more lookup fields to the same parent object, make sure you select the right one. After clicking the name of the lookup field to the parent object, you will be on the setup page of that field.

You will see the Child Relationship Name field. We recommend you append “__r” to that field, as this is best practice, but this is optional because we will append that transparently if it is missing.

Button URL


Specifying the Child Object Fields

As well as specifying the Child Object, you must specify fields on that Child Object. Most fields are optional, but NetSuite requires an Item in every line item.

Also, please note that the field types must match. Item field will need either a direct lookup to NetSuite Item (either via a lookup or master/detail) or a formula field with the NetSuite Item Salesforce Record Id. Quantity and Rate are number fields.

Ordering the Line Items

You can fetch the child records in a particular order and send them to NetSuite in the same order. This can be referenced by another field on the child object:

Button URL


Department

This can be referenced either via another field on the originating object or as a text field in the formula. So you may use either approach:

Button URL (Field Value)
Button URL (Static Value)


Class

This can be referenced either via another field on the originating object or as a text field in the formula. So you may use either approach:

Button URL (Field Value)
Button URL (Static Value)

Button URL


Populating Custom Line Item Fields

We designate a custom field on a line item by starting the line of the Custom URL as &co_cf, which is followed by the orderNumber (optional) and then the type of the custom field (i.e. text, date, etc.) followed by the API name of the NetSuite field. Here is the theoretical construction.

Button URL (Field Value)
Button URL (Static Value)


Add "type" (Required)

The type can be decided by checking the NetSuite Field Type of the line-level custom fields. For more information, please refer to Custom Fields

NetSuite Field Type

Type Value

Example

Date

date

&co_cf_date_netsuite_api_name=formula_field__c

Datetime

datetime

&co_cf_datetime_netsuite_api_name=formula_field__c

List Record (Lookup)

picklist

&co_cf_picklist_netsuite_api_name=formula_field__c

Integer Number

integer

&co_cf_integer_netsuite_api_name=formula_field__c

Decimal Number

number

&co_cf_number_netsuite_api_name=formula_field__c

Currency

number

&co_cf_number_netsuite_api_name=formula_field__c

Percent

number

&co_cf_number_netsuite_api_name=formula_field__c

Check Box

checkbox

&co_cf_checkbox_netsuite_api_name=formula_field__c

Free Form Text

text

&co_cf_text_netsuite_api_name=formula_field__c

Text Area

textarea

&co_cf_textarea_netsuite_api_name=formula_field__c

Long Text

longtextarea

&co_cf_longtextarea_netsuite_api_name=formula_field__c

Email Address

text

&co_cf_text_netsuite_api_name=formula_field__c

Hyperlink

text

&co_cf_text_netsuite_api_name=formula_field__c



Add "orderNumber" (Optional)

Button URL (Field Value)


The order number part in the button URL syntax above determines the order in which the custom fields are displayed in the columns of the line item table.

If we have an order number, they will be displayed as per our preferences:

Button URL (Field Value)

Document image


If no order is given, the custom field columns are added randomly or alphabetically:

Button URL (Field Value)

Document image


Note: You can have a mixture of ordered and non-ordered custom fields. The non-ordered ones will appear at the end.

Populating Line Items from Originating Record Fields

You may have a number of fields on the Originating Record that you wish to populate various line items on the Sales Order/Purchase Order/Bill. This is possible, as long as you specify each and every individual line. This is different from populating child records, where we iterate over each child record. Here, you specify the number of lines in each URL.

The Sales Order/Purchase Order/Bill URL will start the same as always, with the structure taken from the basic Custom URL structure for Sales Order/Purchase Order/Bill fields, where you can specify dates, etc.

However, the URL will then specify line items, using the structure &line#_field=your_field__c

Button URL


Internet Explorer, depending on the version, may have a limit of 2000 characters in the URL. Firefox and Chrome have potentially much longer URL limits, of 30,000 characters and up. Salesforce may have it's own limits. We cannot be responsible for either your browser’s URL character limitation or Salesforce’s URL character limitation. As such, we recommend this approach for just a few lines, however, it may work for dozens of lines or more.

Specifying more than one line

Should you want more than one line, you simply need to start with &line2… and so forth.

Button URL