Follow

BUP - Make Drop-Down Combo-Box Mandatory

Important Notes

The samples and information below is provided without a warranty of any kind. This post is for informational purposes and coresystems ag assumes no responsibility for errors or omissions in the information provided.


Purpose

Attached is one rule that will add the Business Partner name on the Journal Remarks of the A/R Invoice before is added, thus also passing this Remark to the Journal Entry that is created in the Add process.


Requirements

The templates require coresuite Version 3.50 or higher, and SAP Business One 8.8 or higher.


Procedure to use these templates

1. Download the attached BUP_10174_Make_Co... file

2. Import in SAP Business One via > Administration > Add-Ons > coresuite customize > Import / Export > Import rules. In the message box, select “All Active”. Click on “Import”.

To check the rule in action:

Just create a new address for a business partner and try not selecting a country for the address.


Procedure to adjust these templates

This can be adjusted to any combobox on any form by just changing the FormType, ItemUID and Column (if needed) in optimizer.

 

Preview Sample (Optimizer Rule C#):

/*
***** General Information *****
Creator: coresystems software USA, laja
Create Date: 2012 07 10
 
***** StartConfDesc *****
Make combobox mandatory
***** EndConfDesc *****
 
***** Updates *****
YYYY-MM-DD, name: Update Comment
*/
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in [Optimizer Rule] '" + ruleName + "'";
SAPbouiCOM.Form AFORM = customize.B1Connector.GetB1Connector().Application.Forms.ActiveForm;
try 
{
SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix) AFORM.Items.Item("178").Specific;
SAPbouiCOM.ComboBox oCBox = (SAPbouiCOM.ComboBox) oMatrix.GetCellSpecific("7", 1);
if (oCBox.Value.Trim() == "")
{
StatusBar.WriteError("The State Field is Mandatory, please select a state");
customize.B1Connector.GetB1Connector().Application.Forms.ActiveForm.Items.Item("112").Click(SAPbouiCOM.BoCellClickType.ct_Regular);
oCBox.Active = true;
return false;
}
}
catch (System.Exception ex)
{
MessageBox.Show(errorMessage + ": \n" + ex.Message, "OK");
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);
return false;
}
return true;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.