Showing posts with label Pass multiple records. Show all posts
Showing posts with label Pass multiple records. Show all posts

Monday, January 23, 2023

pass marked records to another form in D365FO

[DataSource]
    class ActivityLogDetails
    {
        /// <summary>
        ///
        /// </summary>
        public void init()
        {
            super();

            if (element.args() && element.args().caller() && element.args().record())
            {
                this.query().dataSourceTable(tableNum(ActivityLogDetails)).clearDynalinks();
                helper= MultiSelectionHelper::createFromCaller(element.args().caller());
                helper.createQueryRanges(this.query().dataSourceTable(tablenum(ActivityLogDetails)),fieldstr(ActivityLogDetails, RecId));

                if (element.args().menuItemName() == menuItemDisplayStr(MarkSalesActivityLogReserved))
                {
                    activityLogStatus = ActivityLogStatus::Reserved;
                }
                else if (element.args().menuItemName() == menuItemDisplayStr(MarkSalesActivityLogRejected))
                {
                    activityLogStatus = ActivityLogStatus::Rejected;
                }
                else
                {
                    throw error("@SYS22996");
                }
            }
            else
            {
                throw error(Error::missingRecord(tableId2PName(tableNum(ActivityLogDetails))));
            }

            Ok.enabled(false);
        }

    }

Table browser URL in D365FO

Critical Thinking icon icon by Icons8