Datumsfeld Überprüfung in Einkauf-Bestellungen
Tobias Wissen
Hallo,ich möchte eine Überprüfung durchführen, welche das Buchungsdatum & Fälligkeitsdatum in Einkaufbestellungen beim aktualisieren/hinzufügen vergleicht.
Wenn das Datum identisch ist, soll eine MsgBox erscheinen mit einem Hinweistext. Den kann man dann durch okay weg klicken.
Speicherung soll aber auf jeden Fall durchgeführt werden.
Wer kann mir da mal helfen?!
Gruß Tobias
Friederike Mundt
Hi Tobias,Here is some very simple sample code (written here without validation so no guarantee) which should help to get you started:
[CODE]
// Get the due and posting date from the document
string docDate = TextEdit.GetFromUID(pVal.Form, "10").Value;
string dueDate = TextEdit.GetFromUID(pVal.Form, "12").Value;
// Do nothing if one of the dates is empty
if (dueDate.Length <= 0 || docDate.Length <= 0)
{
return true;
}
// If the dates are the same show the message and continue (return true)
if (dueDate == docDate)
{
MessageBox.Show("Due Date equals Posting Date!", "OK");
return true;
}
[/CODE]
You should add the rule in the optimizer FormDataModify Event and check first with pVal.ActionSuccess = true; that there were no other system messages within SAP Business One coming up.
hth,
Friederike
Tobias Wissen
Hi Friederike,leider erhalte ich immer die Meldung: Nicht alle Codepfade geben einen Wert zurück (CS0161).
Was bedeutet das?
Wie muss ich die Regel im Optimizer sonst einstellen?
Friederike Mundt
Hi Tobias,For Opimizer you always need to return true or false. So in this case you need to add
[CODE]
return true;
[/CODE]
as last row in your code.
Hth
Tobias Wissen
okay. thx. i works
0
Please sign in to leave a comment.
Comments
0 comments