Need to compare 2 reference values (From 2 different tables) and set the flag 'True' or 'False'.

Kunal Verma1
Tera Contributor

Hi All,

 

On Risk(sn_risk_risk) form, I have 2 dot walked fields 'Inherent Assessment' and 'Qualitative Apetite'. I have to fetch these 2 values and compare them.

Condition is : If Inherent Assessment > Qualitative Apetite, We need to set the flag true.

 

Inherent Assessment field is from Table - sn_risk_advanced_risk_assessment_instance

Qualitative Apetite filed is from Table - sn_risk_advanced_risk_appetite_scale

 

Please guide how this can be achieved ? Complete Solution will be very helpful.

Thanks in advance.

 

KunalVerma1_0-1707060632577.png

 

 

KunalVerma1_1-1707060692215.png

 

Reference Fields -

KunalVerma1_0-1707061098697.png

 

KunalVerma1_1-1707061159246.png

 

 

 

2 REPLIES 2

katelyno
Tera Contributor

getting the same problem

GlideFather
Tera Patron

Hi,
Depending on the process:

- onChange client script would handle it immediately the value is changed,

- business rule would handle it right after it is saved for example,

- scheduled job could do it periodically (every 30 min, hourly, weekly, ...)

 

I do not have this module active so cannot show you directly, but create a business rule on the [sn_risk_risk] table make it onBefore on insert and update (mark Advanced true), and use script something like this (it must be played with, this is very drafty I just shot untested):

 

(function executeRule(current, previous /*null when async*/) {

var reference1 = current.sn_risk_advanced_risk_assessment_instance.getDisplayValue();
var reference2 = current.sn_risk_advanced_risk_appetite_scale.getDisplayValue();

if (reference1 == reference2) {
current.key_risk = true;
}
})(current, previous);
You said that the value is to be compared, not the sys id, right? ALso, I do not know the exact Key Risk field name... avoid using update() in BR...
———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */