Script to change payment type works for all except "Credit Card" ?

Hello, 

I am working on a script to change the payment type based on the terms code that is entered in the sales order. This script fires fine for setting the field to "None" or "Check", but when the script is supposed to change the value to "Credit Card" nothing happens. I'm assuming, if this is possible, that I also have to set a value for the payment type in the "Payment" tab? I'm not sure what I would put there, as this is different for each customer and I'm not sure how to initialize. 

Any help with this, or if anyone knows if this is made impossible by design, I would greatly appreciate it. 

Thanks!

Parents
  • 0

    It is customary to post the script so that we can assist with an answer.  How can we know what is wrong if we don't know what the script is doing.

  • 0 in reply to BigLouie

    Thanks for the reply Louie, I was curious as to whether or not this was possible but I will post what I currently have. After checking the database, "None" is not a valid payment type, I had to set this to a blank string. I still am having difficulties setting the payment type to "Credit Card" however. This attempt i tried setting the payment type to what I know is the customer I am using's only credit card type on file. I have also tried setting the value to "Credit Card."

    terms = ""
    pay = ""
    retVal = oBusObj.GetValue("TermsCode$", terms)

    'Check
    if terms = "00" or terms ="07" then
    resul = oBusObj.SetValue("PaymentType$", "Check")
    end if

    'NONE
    if terms = "35" then
    resul = oBusObj.SetValue("PaymentType$", "")
    end if

    'Credit Card attempt 3
    if terms = "5" then
    resul = oBusObj.SetValue("PaymentType$", "AMEX")
    end if

  • 0 in reply to Surya IT

    Actually this worked, I guess I will just need to grab the customers payment type as part of the script and then set accordingly unless you have another suggestion. 

  • 0 in reply to Surya IT

    How would I get a handle on the AR_Customer object to check the default payment type? This wouldn't be considered a child handle would it? 

  • 0 in reply to Surya IT

    You should be using the Case method.

    Select [ Case ] testexpression 
        [ Case expressionlist 
            [ statements ] ] 
        [ Case Else 
            [ elsestatements ] ] 
    End Select 

Reply Children
No Data