Hi all,
When raising a change order, users need to fill out a risk assessment.
The risk assessment populates the field RISK as per below.
There is a requirement to prevent users from initializing the change order if the risk field is NULL.
So for example....a new change order is raised
Now the user will go and initialize change
The user is now in the detail_wf panel
In the detail_wf panel, we currently have a function presaveTrigger()
The preSaveTriger states that
IF the user chooses reject AND the comment field is NULL
THEN an alert message will appear.
See context below
function preSaveTrigger()
{
try
{
var status = document.getElementsByName("SET.status")[0].value;
if (status == "REJ")
{
var comments = document.getElementsByName("SET.comments")[0].value;
if (comments == "")
{
alert("If you reject the change order, please add comment under Task Comments below");
return false;
}
Using similar logic......my requirement is to have another predefined trigger, but it would need to reference the chg table as well as wf table.
My required rule would be
IF chg.risk is NULL then the user cannot save the workflow task. An alert will appear saying "Error - Change Order risk not completed".
Would it be possible to code a preSave trigger in the detail_wf that references data in the chg??
See below example....I am struggling to reference chg fields in the wf panel.
function preSaveTrigger()
{
try
{
var chg.risk = document.getElementsByName("SET.chg.risk")[0].value;
if (chg.risk == "")
alert("Error - Change Order risk not completed");
return false;
}