You can use a Script in Infoplus to automatically add Billing Codes to records, then either run that script through a Trigger, or on a list of selected records, to help automate the creation of Billing Codes.  


Here's an example script to add a billing code to ASN's:

/////////////////////////////
// find the user id to use //
/////////////////////////////
var users = infoplusApi.search("user", "Administrator", null, null, null);
if(!users || users.size() == 0)
{
   utils.log("Could not find user id for associating with billing code");
   return;
}

var userId = users.get(0).userId;
utils.log("User Id: " + userId);

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Either hard-code the billing code type id you want here, or, look it up by name by doing a search like: //
//    infoplusApi.search("billingCodeType", "name eq 'My Name'", null, null, null);                       //
////////////////////////////////////////////////////////////////////////////////////////////////////////////
var billingCodeTypeId = 1;

///////////////////////////////////////////////////////////////////////
// construct a new billing code model object - then set values in it //
///////////////////////////////////////////////////////////////////////
var billingCodeModel = infoplusApi.constructModel("billingCode");
billingCodeModel.userId = userId;
billingCodeModel.quantity = 1;
billingCodeModel.billingCodeTypeId = billingCodeTypeId;
billingCodeModel.recordType = "ASN";
billingCodeModel.lobId = record.lobId;
billingCodeModel.recordId = record.id;
billingCodeModel.note = "Your note here";

var insertedBillingCode = infoplusApi.add("billingCode", billingCodeModel)
utils.log("Inserted billing code id: " + insertedBillingCode.id);


For script like this, you will want its Record Type to be the type that you want to run the script against (that is, the type that you want to add the Billing Codes too).  So for this example, the script's record type would be ASN.  Also, please note, the billingCodes type is only available in API versions greater than 2.0 (including Beta).  


See also: