RE: How to write script to avoid duplicate record creation before record submit using suitescript 2.0
I want to create a user event script to avoid custom record creation if record is duplicate.
Also this custom record is being attached to another custom record. I have to stop from creating and attaching custom duplicate record.
Please Help!!
Are the two fields globally unique, or just unique for the record they are attached to? If they are globally unique, you could combine both field values into a single string and set that as the external id, assuming you aren’t already setting a different value in the externalid. Netsuite will prevent duplicate creation and throw a DUP_CSTM_RCRD_ENTRY error. If the two values are not globally unique, then maybe a combination of those two values and the internal id of the record they are being attached to would work instead. For example: custrecord_field1 + ‘~’ + custrecord_field2 or otherRecord.id + ‘~’ + custrecord_field1 + ‘~’ + custrecord_field2, using whatever separator character makes sense.