Wednesday, January 23, 2019

Search Generated Coupon Code of a Promo Code using SuiteScript?

Question:

 
Search Generated Coupon Code of a Promo Code using SuiteScript?

Answer:

You need to execute a search againts Record Type called Coupon Code. Below is a sample script for reference:

var filters = new Array();

//Internal ID of the Promo Code
filters[0] = new nlobjSearchFilter( 'promotion', null, 'anyOf', 3);

var columns = new Array();
columns[0] = new nlobjSearchColumn( 'promotion' );
columns[1] = new nlobjSearchColumn( 'code' );
columns[2] = new nlobjSearchColumn( 'internalid' );


var results = nlapiSearchRecord('couponcode', null, filters, columns);

The above script will return all of the generated Coupon Code for a certain Promo Code.

No comments:

Post a Comment