- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 08:26 AM
onLoad client script on Incident table. Functionality was intended to be: Check status and display message accordingly. Was not working as expected, so I added messages 1 and 2.
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getDisplayValue('u_contractor_incident_no') > 0) {
if (g_form.getDisplayValue('u_contractor_status') == '2') {
g_form.addErrorMessage('Contractor Incident Complete. No further updates will be received.');
}
else if (g_form.getDisplayValue('u_contractor_status') == '3') {
g_form.addErrorMessage('Contractor Incident Closed. No further updates will be received.');
}
else if (g_form.getDisplayValue('u_contractor_status') == '4') {
g_form.addErrorMessage('Contractor Incident Cancelled. No further updates will be received.');
}
else if (g_form.getDisplayValue('u_contractor_status') == '10') {
g_form.addErrorMessage('Contractor Incident Returned. No further updates will be received.');
}
else{}
g_form.addErrorMessage('1. Contractor Status is ' + g_form.getDisplayValue('u_contractor_status'));
}
else {
g_form.addErrorMessage('2. Contractor Incident number is ' + g_form.getDisplayValue('u_contractor_incident_no'));
}
}
Message #2 is now displaying, but the message reads "2. Contractor Incident number is INC000999999", and is the currently displayed Incident number, rather than the field specified. Am I somehow making a reference to the 'number' field, and not realizing it? I verified that the 'u_contractor_incident_no' is not the same value as the local Incident number.
Any assistance greatly appreciated.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- 6,712 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 10:03 AM
This is strange. I'm out of ideas, but maybe try simply using g_form.getValue('u_contractor_incident_no');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 09:09 AM
What happens when you do something like this:
var no = g_form.getDisplayValue('u_contractor_incident_no');
if (no.length > 0) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 09:44 AM
function onLoad() {
//Type appropriate comment here, and begin script below
var sts = g_form.getDisplayValue('u_contractor_status');
var no = g_form.getDisplayValue('u_contractor_incident_no');
if (no > 0) {
if (sts == '2') {
g_form.addErrorMessage('Contractor Incident Complete. No further updates will be received.');
}
else if (sts == '3') {
g_form.addErrorMessage('Contractor Incident Closed. No further updates will be received.');
}
else if (sts == '4') {
g_form.addErrorMessage('Contractor Incident Cancelled. No further updates will be received.');
}
else if (sts == '10') {
g_form.addErrorMessage('Contractor Incident Returned. No further updates will be received.');
}
else{}
g_form.addErrorMessage('1. Contractor Status is ' + sts);
}
else {
g_form.addErrorMessage('2. Contractor Incident number is ' + no);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 09:45 AM
I changed both to variables. Same result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 09:46 AM
If there were another Client Script running, with "Global" checked, that happened to use the same variable, could mine pick that value up?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 09:49 AM
Maybe this will help: I moved messages 1&2 together at the end. BOTH variables come back as the current incident number.