
Goal:
When Account.Status = "Government Affairs" the Status caption should appear in red and a new highlighted field (Critical Notes) should appear at the bottom of the Account Detail form. When the Status does not equal "Government Affairs" the Status caption should be in standard black and the Critical Notes field should not be visible.
See attached screenshot for final result.
Fields:
Account.CriticalNotes = memo
Account.Status = Text (Default field)
Account Status OnChange Action:
Add the following C# Snippet to the Status Onchange Action
// txtCriticalNotes and Status OnChange
if (this.Status.PickListValue == "Government Affairs")
{
this.txtCriticalNotes.Visible = true;
this.txtCriticalNotes.BorderWidth = 4;
this.txtCriticalNotes.BorderColor = System.Drawing.Color.Red;
this.txtCriticalNotes.BackColor = System.Drawing.Color.BlanchedAlmond;
this.txtCriticalNotes_lbl.ForeColor = System.Drawing.Color.Red;
this.Status_lbl.ForeColor = System.Drawing.Color.Red;
this.Status.BorderWidth = 4;
this.Status.BorderColor = System.Drawing.Color.Red;
}
else
{
this.txtCriticalNotes.Visible = false;
this.txtCriticalNotes_lbl.ForeColor = System.Drawing.Color.White;
this.Status_lbl.ForeColor = System.Drawing.Color.Black;
this.Status.BorderWidth = 0;
this.Status.BorderColor = System.Drawing.Color.Black;
}
// End On Change
Account Detail Load Action
Add the following C# Snippet to the Account Detail Load Action.
Note, everything before "//txtCriticalNotes and Status load Action" is on the Account Detail form by default
//Begin Load Action
Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;
pklSubType.PickListName = account.GetSubTypePickListName();
// txtCriticalNotes and Status load Action
if (this.Status.PickListValue == "Government Affairs")
{
this.txtCriticalNotes.Visible = true;
this.txtCriticalNotes.BorderWidth = 4;
this.txtCriticalNotes.BorderColor = System.Drawing.Color.Red;
this.txtCriticalNotes.BackColor = System.Drawing.Color.BlanchedAlmond;
this.txtCriticalNotes_lbl.ForeColor = System.Drawing.Color.Red;
this.Status_lbl.ForeColor = System.Drawing.Color.Red;
this.Status.BorderWidth = 4;
this.Status.BorderColor = System.Drawing.Color.Red;
}
else
{
this.txtCriticalNotes.Visible = false;
this.txtCriticalNotes_lbl.ForeColor = System.Drawing.Color.White;
this.Status_lbl.ForeColor = System.Drawing.Color.Black;
this.Status.BorderWidth = 0;
this.Status.BorderColor = System.Drawing.Color.Black;
}
//End Load Action}
You must be a registered user to add a comment here. If you've already registered, please log in. If you haven't registered yet, please register and log in.