Saturday, 12 October 2019

how to get all datasource in form event handlers in dynamics d365

how to get all datasource in form event handlers in dynamics d365

[FormEventHandler(formStr(HcmWorkerPositions), FormEventType::Closing)]
    public static void HcmWorkerPositions_OnClosing(xFormRun sender, FormEventArgs e)
    {
        FormRun         element = sender;
        FormRun         formrun;
        FormDataSource  formDatasource;
        int             idx;
        str             name;

        formrun = element.args().caller();

        name = element.args().callerName();
//sender.dataSource(formDataSourceStr(HcmWorkerPositions, hcmWorker)); you can also try this.
        if(formrun && name == 'hcmWorker')//hcmworker is second datasource.
        {           
            for(idx=1;formrun.dataSourceCount();idx++)
            {
                if(formrun.dataSource(idx).cursor() is HcmEmploymentDetail)
                {
                    formDatasource = formrun.dataSource(idx);
                    formDatasource.research(true);
                    break;
                }
            }
        }
    }

No comments:

Post a Comment

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...