How to disable checkbox Control on form

Hi All,

I am working on D365 FO.

I have form with multiple grids and I am opening the form with menu-item button

when form is opened I have multiple records in the grid.

I have field(NOYES) in the grid , now I want disable the checkbox field in form for particular records which are having one particular status.

If anybody have an idea Kindly suggest where can I write the logic and how can I achieve this.

Thanks

Haribabu

You can do this using the onInitializing() event on the form itself.

Use a While Select on each record and look at its status. Inside that while add an “if else statement”. You will need to have the FormCheckBoxControl defined using sender.

Make sure you have the checkbox control’s AutoDeclaration property set to yes.

onInitializing()
{
    FormDataSource datasourceTable_ds = sender.datasource(formDataSourceStr(<Datasource>));
    table table = datasourceTable_ds.cursor();
    FormCheckBoxControl checkbox = sender.design().controlName(formControlStr(<Form>, <Control>));
    while select * from table
    {
        if(table.status == enumType::Created)
        {
            checkbox.allowEdit(false);
        }
        else
        {
            checkbox.allowEdit(true);
        }
    }
}

Thanks Anthony it worked…