- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
I've got 5 onChange Client Scripts to be applied to 5 fields in a catalogue item that I've been working on. The five fields are:
The values of the five fields should automatically be updated to Severe (3) if the following question is Highly Confidential:
That works fine. I've got another requirement that states that if the above question is not Highly Confidential and the below question is 'Yes', then the values of the 5 fields should be set to Material(4)
However, what I've found in my client script is that if the first question is Highly Confidential and the 5 fields are below Material, if I then set the PCI DSS question to 'Yes', then the fields automatically get updated to 'Material'. This should not happen since the first question is Highly Confidential and should not consider the outcome of the PCI DSS question, so the five fields shouldn't get updated The below code I'm using is:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
I found the issue. It was because I was referring to the wrong variable for the PCS field in a different client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hi @matthew_hughes ,
Solution: Prioritize and Isolate Highly Confidential Logic
You need to short-circuit the evaluation so that if the classification is "Highly Confidential", the script does not evaluate PCI DSS or SOX logic at all.
if (confidenRating === 'highly_confidential') {
// Only apply Highly Confidential logic
booleanField = isValid_HighlyConfidential(newValue, reputation, customer, regular, colleagues);
context = 'highly_confidential_function';
alert('Highly Confidential Function Applied');
} else {
// Only evaluate PCI DSS and SOX if classification is NOT Highly Confidential
if (pcsResponse === 'yes') {
booleanField = isValid_PCSDSS(newValue, reputation, customer, regular, colleagues);
context = 'pcsResponse_function';
alert('PCS Response Function Applied');
} else if (sox && extSox) {
booleanField = isValid_Sox(newValue, reputation, customer, regular, colleagues);
context = 'sox_function';
alert('Sox Function Applied');
}
}
This ensures that once "Highly Confidential" is detected, no other logic is evaluated, and the five fields remain correctly set to Severe 3.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Best,
Anupam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hi @Anupam1 I've tried the below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
The script you've provided doesn't make sense to me because I am expecting an onChange for
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hi @SVimes
This is the code for that particular field:
