Disallow the creation of bill if reference already exists for a vendor through csv imports.

  1. if (scriptContext.type == scriptContext.UserEventType.CREATE), then check whether it is a vendor bill.
  2. Get the values of vendor and reference number from the current record.
  3. Create search to get the count of reference number which is entered in the vendor bill. Return the count.
var searchBillResultCount = vendorbillSearchObj.runPaged().count;
return searchBillResultCount;
  1. If count is greater than zero, then throw an error in the csv response file.
  2. Otherwise, if count equals to zero then record is imported successfully.

Leave a comment

Your email address will not be published. Required fields are marked *