
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 10:01 PM
Hi Everyone,
Can someone provide sample of a sample script for GRC: Advance Risk - Automated Scripted Factor.
I have this requirement to automatically calculate the score of a company.
Example:
If company is greater than 5 years it would score 10, else it would score 1.
I'm not sure if this is also possible via automated factors only, since there is only a query you need to specify.
I'm looking to make it dynamic depends on which company is being factored.
Thanks,
Tadz
Solved! Go to Solution.
- Labels:
-
Integrated Risk Management (IRM)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 11:51 PM
Hi, I think I made it work.
See sample script:
var gr = new GlideRecord('sn_grc_profile');
gr.get(entity);
gr.query();
var gr2 = new GlideRecord('core_company');
gr2.addQuery('sys_id',gr.applies_to);
gr2.query();
if(gr2.next()){
result.score = gr2.<field_name>;
}
else{
result.score = 0;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 11:05 PM
I tried using Automated Script Factors:
It says
but somehow when i try to query it using these script:
var gr = new GlideRecord('core_company');
gr.addQuery('sys_id',entity.toString());
gr.query();
if(gr.next()){
result.score = 1;
}
else{
result.score = 10;
}
Somehow its not getting the record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 11:51 PM
Hi, I think I made it work.
See sample script:
var gr = new GlideRecord('sn_grc_profile');
gr.get(entity);
gr.query();
var gr2 = new GlideRecord('core_company');
gr2.addQuery('sys_id',gr.applies_to);
gr2.query();
if(gr2.next()){
result.score = gr2.<field_name>;
}
else{
result.score = 0;
}