Script to change orders PhoneNumber

Many of my German Ebay orders come into Linnworks with the value 'Invalid Request' in the Phonenumber Field.


This causes us problems when uploading to the carriers websites as the PhoneNumber field is no longer numeric.


I've started creating a script: 


namespace linnworks.finaware.CommonData.Objects // leave untouched

{ // leave untouched

    public class ScriptMacroClass : linnworks.scripting.core.IOrderScript // leave untouched

        { // leave untouched

            public void Initialize(linnworks.finaware.CommonData.Objects.Order order,linnworks.scripting.core.Debugger debug) // leave untouched

            { // leave untouched


             if(order.Source.ToUpper().Trim() == "EBAY" && order.Country.ToUpper().Trim() == "GERMANY"){

                 if(order.PhoneNumber.ToUpper.Trim() == "INVALID REQUEST"){

                    order.PhoneNumber = 0;

                    order.Save(0);

                  }

              }

            } // leave untouched

 

            public string Filter(){ // leave untouched

                /*Optional: Specify your order filter in query variable, must be SQL Statement that outputs pkOrderId column ONLY*/

                string query="";

                return query;

            }

 

    } // leave untouched

}     


I currently get an error saying: 'Linnworks.finaware.CommonData.Objects.Order' does not contain a definition for PhoneNumber


1 person has this question

A member of the support team informed me it is BuyerPhoneNumber not Phonenumber

Hi Paul,


I'm having a very similar problem.


When we want to print a UPS shipping label for an order we can't do so if the phone number field is blank. We need to manually change it to any dummy number, and then the shipping label will print.


Please can you help me with the script? 


What I want is a script that will replace a blank phone-number field with the dummy phone number that we choose. This should run on any order that's being assigned to UPS (via the rules engine, that I've already set up) and has a no phone number.


What's the code for a blank field (there's no error in the phone number field, it's just empty).


Thanks


Isaac

I need this too, UPS orders with blank phone number did anyone manage to sort?

Phone number should be in the Rules Engine options

Hello Paul, Isaac and David,


This is Ethan from HyperCommerce. 


I believe you have been able to resolve this by now. It's possible to automatically assign a default number for downloaded orders that do not have a phone number speicified. We can do this using a custom script or by using a Linnworks Rules Engine Macro or API to update these.

If you still require further help or custom solutions such as Advanced SQL Queries, Custom Reports, API Solutions or Integrations, please feel free to reach me at ethan@hypercommerce.co.uk

 

Kind regards.


Login to post a comment