- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 05:57 AM
Hi Guys,
Need small help ....
How to write transform map script to check the contact's email is duplicate or not.
If duplicate email is found then ignore that record and populate a message that 'Duplicate email'.
Thanks!
Chhavi Agnihotri
Solved! Go to Solution.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 07:02 AM
@Chhavi Dixit This can be an event based onBefore transform script which will trigger before the transforming of every single row.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 06:29 AM
@Chhavi Dixit Please check if the following script works for you.
// Check if the current email exists in the target table
var email = source.u_email; // Replace 'u_email' with the source field name for email
if (email) {
    // Query the target table (replace 'sys_user' with your target table if different)
    var contactGR = new GlideRecord('sys_user'); 
    contactGR.addQuery('email', email); // Replace 'email' with your target table's email field
    contactGR.query();
    if (contactGR.next()) {
        // Duplicate found, ignore the record
        ignore = true; // This will skip the current record
        gs.log("Duplicate email found: " + email + ". Skipping record.");
    }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 06:36 AM
Thanks for quick response, could you please suggest me if this is explicit transform map script or event based transform map script.
Thanks!
Chhavi
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 07:02 AM
@Chhavi Dixit This can be an event based onBefore transform script which will trigger before the transforming of every single row.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 07:58 AM
Thank you so much @Sandeep Rajput 🙂
