Link

Example Structure for a New Sales Order

The structure of a Custom URL creating a new Sales Order is below. We are using Sales Order as an example. More detail on other objects are described later

/apex/breadwinner_ns__CreateSalesOrder
?originating_record={!salesforce_record_ID}
&parent_account=api_field_name__c
&custom_form=sales_order_custom_form_api_field__c
&currency=sales_order_currency_api_field__c
&department=sales_order_department_api_field__c
&class=sales_order_class_api_field__c
&date=sales_order_date_api_field__c
&preceeding_ns_record=sales_order_created_from_api_field__c
&order_number=sales_order_number_api_field__c
&po=sales_order_po_api_field__c
&memo=sales_order_memo_api_field__c                       
&testing=true

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 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.

&child_relationship_name=child_name__r

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. We have listed the required fields in red.

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.

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 approaches:

&co_department=dept_api_field__c
&co_department="123"

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 approaches:

&co_class=class_api_field__c
&co_class="123"
&co_netsuite_item=netsuite_item_field__c
&co_description=description_field__c
&co_quantity=quantity_field__c
&co_rate=rate_field__c
&co_department=department_field__c
&co_class=class_field__c

Populating Custom Line Item Fields

(This section does not refer to lookups or picklists which are explained in another section of this document. This section only refers to other data types)

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 type of the custom field (in this case a picklist) followed by the API name of the NetSuite field. Here is the theoretical construction.

&co_cf_type_netsuite_api_name=formula_field__c
&co_cf_type_netsuite_api_name="123"
NetSuite Field TypeType ValueExample
Datedate&cf_date_netsuite_api_name=formula_field__c
Datetimedatetime&cf_datetime_netsuite_api_name=formula_field__c
List Record (Lookup)picklist&cf_picklist_netsuite_api_name=formula_field__c
Integer Numberinteger&co_cf_integer_netsuite_api_name=formula_field__c
Decimal Numbernumber&cf_number_netsuite_api_name=formula_field__c
Currencynumber&cf_number_netsuite_api_name=formula_field__c
Percentnumber&cf_number_netsuite_api_name=formula_field__c
Check Boxcheckbox&cf_checkbox_netsuite_api_name=formula_field__c
Free Form Texttext&cf_text_netsuite_api_name=formula_field__c
Text Areatextarea&cf_textarea_netsuite_api_name=formula_field__c
Long Textlongtextarea&cf_longtextarea_netsuite_api_name=formula_field__c
Email Addresstext&cf_text_netsuite_api_name=formula_field__c
Hyperlinktext&cf_text_netsuite_api_name=formula_field__c

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

&line1_netsuite_item=netsuite_item_field__c 
&line1_description=description_field__c     
&line1_quantity=quantity_field__c           
&line1_rate=rate_field__c                   
&line1_department=department_field__c       
&line1_class=class_field__c              
&line1_location_id=location_field__c        
&testing=true                                   

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.

&line1_netsuite_item=netsuite_item_field__c                                                 
&line1_quantity=quantity_field__c                                                          
&line1_rate=rate_field__c                   
&line2_netsuite_item=netsuite_item_field__c
&line2_quantity=quantity_field__c          
&line2_rate=rate_field__c                   
&line3_netsuite_item=netsuite_item_field__c
&line3_quantity=quantity_field__c     
&line3_rate=rate_field__c                

Table of contents