Reputation: 860
Is there a way to deploy a SuiteScript against all transaction record types? (other than creating a separate deployment for each type of transaction)
Upvotes: 0
Views: 829
Reputation: 3029
Deploy to all transaction record types and then apply a conditional in your code like this:
var recordType = nlapiGetRecordType();
if(recordType != 'salesorder' && recordType != 'purchaseorder'){
return; //Exit
}
//Continue code here.
Upvotes: 0
Reputation: 577
You can deploy to all records and then put an if statement if nlapiGetRecord() is one a transaction type.
var txnTypes = ['salesorder','invoice','purchaseordet'];
if(txnTypes.indexOf(nlapiGetRecord()!=-1) { //code goes here; }
Either way is 50/50 on which is easier. I would say the deployments would be best because it don't run on the other record.
Upvotes: 1