Hi all, I want to call a standard lookup form with a RecordReference instead of the record (Form.Run(0,RecRef)), but it seems not to be possible because Attain insists on a record as parameter. Anyone knows a solution? Thanks!
When you perform a Form.Run the RecRef isn’t really using the record. Insted you are passing the filters that have been applied to the record. You can get around this with a little work: In the form that you want to call, create a function to receive the values you want to use to open it. Then create a global variable to match each value you are passing. In the function, have it transfer the local (parameter) values to the global values. Next, OnFormOpen set your filters. In the calling object: Create a Variable of form type. Call the Lookup forms function that we created above. Run the lookup form. Hope this helps!
I understand that the RecordReference is kind of a pointer to a record, not the record itself. But this is the problem, because I don’t want to run a specific form to which I can pass the record as a parameter as you described. The backround: I have a temporary table consisting of a table ID and the RecordID (Key-fields and -values) in each record, which I display in a form. If the user pushes a button, the standard lookup-form for the record (which I want to identify via the table ID) should open and display the record (filtered using the RecordID). I don’t want to do something like “IF RecordID = 27 then FORM.RUNMODAL(31,Item)” and so on for every possible table ID I could find in my own table, because IMHO it is the point in the whole RecordRef and FieldRef stuff to get rid of those not object orientated programming style. But it seems that C/AL lacks this feature :-(. I was also thinking about defining a temporary table with dummy-fields, to which I transfer the values from the records I found using table ID and RecordID (using the technique you described), but I can’t define a table with so many textfields of 250 chars length… But anyways I thank you for your help, Bill!