Good morning,
Is it possible to prevent the record form from closing using the ITrimAddin interface?
We're writing an external link to dynamically set mandatory fields on a record entry form based on the value of a UDF. The code works fine and displays a message box to the user to notify them that certain fields are mandatory, but when clicking OK they're presented with a message that saving the record was cancelled by the add-in. Is there a way to simply return the user to the record form when clicking OK?
Here's the code we're calling in the PreSave function:
if(GetFieldValue("RecordStatus", record) == "Submitted")
{
foreach (string field in fields)
{
if (String.IsNullOrEmpty(GetFieldValue(field, record)))
missingFields.Add(field);
}
string missingFieldsCSV = string.Join(", ", missingFields);
if(missingFieldsCSV.Length > 0)
{
string message = record.Number + " requires the follwing fields to be populated:" + Environment.NewLine + missingFieldsCSV;
DialogResult dialogResult = MessageBox.Show(message, "Content Manager", MessageBoxButtons.OK);
return false;
}
}
Thanks,
Jason