45

As discussed in https://www.yammer.com/dynamicsnavdev/threads/1430313497944064


The following code is possible to use today, even though it might not be recommended, and it's not (yet) officially supported:

---

RecRef.Open(27);

RecRef.FindFirst();

VariantRecRef := RecRef;

Codeunit.Run(5431, VariantRecRef);

RecRef := VariantRecRef;

[Do something with the results in RecRef...]

---


In a similar way, this is also possible:

---

RecRef.Open(27);

RecRef.FindFirst();

VariantRecRef := RecRef;

Page.Run(30, VariantRecRef);

---


These are flexible and all, but it just feels as if there are unnecessary (and memory plus performance expensive) casting involved.


I suggest that the platform is improved to support the following overloads of Codeunit.Run() and Page.Run[Modal]():


[Ok := ] Codeunit.Run(Number: Integer, var RecRef: RecordRef)


Page.Run(Number: Integer, RecRef: RecordRef[, FieldNo: Integer])

Page.Run(Number: Integer, RecRef: RecordRef[, FieldRef: FieldRef])


[Action := ] Page.RunModal(Number: Integer, RecRef: RecordRef[, FieldNo: Integer])

[Action := ] Page.RunModal(Number: Integer, RecRef: RecordRef[, FieldRef: FieldRef])


I hope the signatures are self-explanatory.


I found this idea, that is somewhat related. If RecordRef and Record could be casted to each other, above would also be solved. https://experience.dynamics.com/ideas/idea/?ideaid=08a6c1b1-2583-eb11-8ced-0003ff45ceba

Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team

Comments

J

Nice one, you can achieve this also by using a codeunit Page Management.

Category: Development