how to set select record in form?


It would be nice if someone could help me. I have a record ID and I need to select row in a form based on that value. In FormRun methods couldnt find a method which does that. Can you please help?

Best regards,


You seemed to miss my answer in your previous thread: If you must find the record somewhere in a grid, you can use positionToRecord() of the form data source.

There is also positionToRecordByValue() method, in case it’s more suitable. But what you said in your previous thread sounded like you have a full record and therefore I suggested positionToRecord().

formRun doesnt have any of these methods. Cant find both of them in Application explorer either. Do i need to extend FormRun class and add them? What would be the code to add?

Best regards,


Form data source is FormDataSource class. FormRun is the whole form, not a data source.

Use this.positionToRecord() to refer to it from other data source methods. Use MyDataSourceName_ds.positionToRecord() to call it from other places in your form. And if you want to call it from outside the form, you must first get a reference to the right data source object

You should have asked in your original thread - now we have two threads about the same thing and this one is missing context. Let me at least add the version tag (and make sure that you add by yourself next time) - it’s critical, because these methods exist only in D365FO.

Your are the best! Now I understood how to access form datasource. Thank you!