Thursday, September 20, 2018

Dynamically Add Credit Card Numbers Using SuiteScript


Automatically populate credit card information after an Invoice record gets converted to a Customer Payment. 

Sample Code Snippet: 

 

function setCCNum()
{
var customerpayment = nlapiTransformRecord('invoice', '317277', 'customerpayment');
var linecount = customerpayment.getLineItemCount('apply');
        for(var i = 1; i<=linecount; i++)
        {
            var doc = customerpayment.getLineItemValue('apply','doc', i);
            if(doc == '317277')
             {
                 customerpayment.setLineItemValue('apply', 'amount', i, '442.0');
                 customerpayment.setLineItemValue('apply', 'apply', i, 'T');
            }
        else
            {
                customerpayment.setLineItemValue('apply', 'apply', i, 'F');
            }
         }   
        customerpayment.setFieldValue('ccnumber', '****************');
        customerpayment.setFieldValue('ccexpiredate', '7/2020');
        customerpayment.setFieldValue('ccname', 'Test CustomerName');
        customerpayment.setFieldValue('chargeit', 'F');
 var cpId = nlapiSubmitRecord(customerpayment, true);
 nlapiLogExecution('debug', 'customerpayment created', cpId);

}

 

4 comments:

  1. This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. credit card with 650 credit score

    ReplyDelete
  2. This article is an appealing wealth of informative data that is interesting and well-written. I commend your hard work on this and thank you for this information. You’ve got what it takes to get attention. 650 credit score good or bad

    ReplyDelete
  3. This is an awesome article a debt of gratitude is in order for sharing this enlightening data. I will visit your site consistently for some most recent post. I will visit your website consistently for Some most recent post. max credit score

    ReplyDelete
  4. Building an Access information base typically begins with chipping away at the tables first and getting the right sorts of informational index in your application from the beginning saving you a ton of time and cerebral pains later when computing and alluding to numeric qualities somewhere else.https://numbersdata.com/

    ReplyDelete