set manadaory as field in PickingListRegisteration form

Hi,

I have Picking registration form ,I have a customized field like “Sales”,I want to set this field as mandatory for some condition and not mandatory for some condition.

I have added the code in wmsorder ds in active method of wmsorderregisteration form,but I facing pblm in picking registration grid like not satisfied condition “inventTable.Salesinvt == NoYes::No” also set as mandatory .Can anyone tell me to solve the pblm.

In Active method of Wmsorder datasource in wmsorderregisteration form.

select inventTable where inventTable.ItemId == WMSOrderTrans.itemId;
if(inventTable.Salesinvt == NoYes::Yes) //Customized field “Salesinvt” in inventtable
{
WMSOrderTrans_ds.object(fieldNum(WMSOrderTrans, Sales)).mandatory(true); //customized field “Sales” in wmsordertrans
}
else
{
WMSOrderTrans_ds.object(fieldNum(WMSOrderTrans, Sales)).mandatory(false);
WMSOrderTrans_ds.object(fieldNum(WMSOrderTrans, Sales)).allowEdit(false);
}

Instead of making it mandatory, have your validation in validateWrite method.

Please don’t create duplicate threads and also post in the related forum ( moving to developer forum).

Hi,
I want to set this field as mandatory in form.I created validate write method in form data source but mandatory for this field is not set can u tell me the how to set the mandatory for satisfied condition(inventtable.Salesinvt == yes).

Keeping Mandatory property to Yes is not only option to make field mandatory and this cannot be done all the times.
So write your logic in validateWrite method and throw an error based on your requirement, this stops the record saving into the database if the validation fails.