Vendor risk management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 09:38 AM
Hi All,
Good day to all,
I have requirement to avaoid the duplicate vendor assessment to the vendor .vendor can see the assessments under the assessment in the related list and Once any vendor assessment is created to a vendor amd if next time that same assessment is went to the same vendor i have check the same assessment in the related list kf assessments in the vendor and i need to stop the assessment and need to populate the error message . How can i avoid the duplicate assessments for any vendor in assessments in the related list .Please find the attached script .
script :
Before Br , insert / Update and table name is sn_vdr_risk_asmt_assessment
Var vendorName = current.getDisplayValue("fild name and its refence field");
Var assessmentName = current.name ;
Var gr = new GlideRecord(" core _company");
gr.addQuery("filed name " , vendorName );
gr.query();
If (gr.next()){
Var gr1 = new GlideRecord("sn_vdr_risk_asmt_assessment");
gr1.addQuery("core_company", gr.sys_id);
gr1.addQuery("name" , assessmentName);
gr1.query();
if(gr1.next()){
gs.addErrorMessage("duplicate record is found);
return false ;
}
}
return true ;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 09:45 AM - edited 11-17-2023 09:45 AM
@sushma9 Update your BR script as follows.
var vendorName = current.getDisplayValue("fild name and its refence field");
var assessmentName = current.name ;
var gr = new GlideRecord(" core _company");
gr.addQuery("filed name " , vendorName );
gr.query();
if (gr.next()){
var gr1 = new GlideRecord("sn_vdr_risk_asmt_assessment");
gr1.addQuery("core_company", gr.sys_id);
gr1.addQuery("name" , assessmentName);
gr1.query();
if(gr1.next()){
gs.addErrorMessage("duplicate record is found);
current.setAbortAction(true);//Abort duplicate insertions
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 09:50 AM
@Sandeep Rajput
the br which i am writing is on the sn_vdr_risk_asmt_assessment table . And in the related when i clicked on the assessments in the related list and clicked on any record the record is opening and that is also the same br table . Can i use the same table in the br again

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 09:53 AM
@sushma9 Yes you can query the same table in BR again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 10:07 AM
its not working again the duplicate assessments are creating