I have written SuiteScript scripts and a web service to do custom credit card processing. I've signed the correct forms and sent them to NetSuite to unmask credit card numbers for admins. When I am logged in as an admin, everything works great.
Now I am testing some roles that do not have the ability to see the credit card numbers. My script is running as admin as a fefore submit function.
In the restricted role, when a sales order is saved my script sees the following fields:
ccnumber => set to the masked credit card number (eg. ************4444) I was really hoping that since my script was running as admin, this would always be the full number.
creditcard => set to an integer like 2. This come from the Credit Card select input on the sales order form where you pick the a credit card number that is stored in the customer record. If I show the internal ids in the UI, this number is the id of the credit card record displayed in the sublist on the customer form.
Ok, I figure since my script is running as admin, it can go to the database and load the real credit card number. If the creditcard field above is set, I would like to find the record that is being displayed in the customer record.
Has anyone written a script to do anything like this? I can use nlapiSearchRecord to find all the customer's credit card records but I don't know how to say I want the one with the id stored in the "creditcard" field on the sales order. My last resort is to just try matching the last four digits found in the ccnumber field with the credit card numbers found in the customer record or in the sales order record.
Is there an undocumented record type for the credit card records that would allow me to make a call like this:
nlapiLookupField('????????', creditCardId, 'ccnumber');