This article discusses how to setup order mappings with custom logic. Note that this is an advanced feature; please familiarize yourself with our standard order mapping features before attempting to setup custom mappings.
You can create custom mappings on our order mapping page. Before starting, you should know how to create basic mappings.
Custom mappings are best taught through an example. Let's suppose that you ship orders within the US, and you want to use a different order Location for California than you do for the rest of the US. To start setting up such a mapping, you should first click the Add Mapping Row button found towards the bottom of the page, and add a mapping for Location.
Close the window, and change the Mapping Type for the new Location mapping to Order Header Customizable. The Value column will then switch to a link, similar to the process for Order Header Translation mappings. Click this link to open the custom mapping window.
When you open the custom mapping window, you'll see three rows, each with a number of dropdowns and text boxes. The first row allows you to check a condition. Rows two and three allow you to set the value for Location when the condition is true and false, respectively.
Let's start with row 1. The condition we want to check is whether the shipping state is California. In other words, we want to check if the Order Header Value 'Shipping State' equals the Fixed Value 'California'. You'll notice the first dropdown currently says Fixed Value; according to the logic we've just described, this should be an Order Header Value, so select this value from the dropdown. When you do so, the following text box will change to a dropdown. You can then select Shipping State from that dropdown.
The next dropdown contains the various operations we can use. It's currently set to Equals, which is correct, as we want to check whether the Shipping State equals California.
The final two boxes dictate the second value we're checking in our condition. We want to check the Shipping State against the Fixed Value 'California', so Fixed Value is correct for the fourth dropdown. Lastly, we can enter California in the final box to complete our condition.
Now, in rows two and three, we want to set the Location we use when the condition is true, and the condition to use when it's false. You'll see the first dropdown is already set to Fixed Value. This is correct, as we want to set a fixed location whenever the condition is true. In the second box, you'll either see a dropdown or a text box, depending on whether your location data is loaded into FarApp or not. If your location data is not loaded, you can retrieve it by pressing the Reload NetSuite List Values button. Select or enter a location to use here; in our example, we use Location 12.
Lastly, we select a Location to use when the condition is false. Again, the type is Fixed Value, and you can select any other Location arbitrarily; we use Location 2.
With all this in place, you could hit Save Changes, and FarApp would setting the Location to 12 for orders shipping to California, and setting it to Location 2 for any other orders. You shouldn't save this mapping unless you actually want to use it, however.
You can use the concepts we've discussed here to setup a variety of mappings. Under the dropdown that says Equals, you'll see a number of other operations you can use to check conditions. For instance, suppose you want to check whether an order's Shipping State starts with 'C'. You could simply change the value 'Equals' to 'Starts With' and value 'California' to 'C'. If you don't know how an operation works, try selecting it and then hovering over it with your mouse; some operations have tooltips which help explain them.
Under the dropdowns which include Order Header Value and Fixed Value, you'll see another option: Computed Value. This option lets you setup much more complex logic. For instance, maybe you want the second value you're checking in your condition to vary based on a second condition. This feature would allow you to set that up.
Try selecting Computed Value for the second value; the next text box will change to a link. Clicking that link will take you an interface that looks exactly like the one you've just been working on, except with blank values. Here, you can check another condition, and set the resulting value if the condition is true or false. Whatever the result of this check, the result will become the second value in your original condition. You can click 'Go Back' to return to your initial condition.
You'll notice that there's also a new dropdown when you click on the Computed Value link, currently set to 'Set Value Conditionally.' If you click this dropdown, there's another option Calculate Value. If you select this option, the condition checking interface will be replaced with another interface that lets you modify and calculate new values, using operations such as addition and multiplication, as well as text editing (like converting a value to upper case).
The customizable mapping screen also allows you to string multiple values together. Suppose you want to post the order ID to the PO # field, but include the prefix 'Order Number: '. To do so, add a new mapping for PO #, change the Mapping Type to Order Header Customizable, and open the mapping interface.
There's a couple new things to take note of when mapping to fields like PO # (which, unlike Location, support stringing multiple values together). First, the Value Type dropdown is available outside of Computed Values, and there's a new option 'Set Value'. This option lets you set the output to a simple Fixed Value or Order Header Value. We'll use this to create our compound value, which we'll create by appending the Fixed Value 'Order Number: ' with the Order Header Value 'Order ID'. There's also a new button called Append Value.
Let's start by changing the Value Type to Set Value. Then, we simply keep the first dropdown as Fixed Value, and set value of the following text box to 'Order Number: '. Next, we want to append another value to this Fixed Value, so click Append Value. This added another set of rows with the same options as the first. Once again, set the type to 'Set Value'. We're appending an Order Header Value this time, so set the first dropdown to Order Header Value, and the following dropdown to Order ID to complete the mapping.