Fastest way to set MenuItemContext in EP

A reference to what I believe is (one of the) easiest way to pass the context to a MenuItem in EP.

AxUrlMenuItem menuItem = new AxUrlMenuItem("epdocuget");

long docuRefRecId = (long)this.YOURDS.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("getDocuRecId", clickedRecId);

if (docuRefRecId  != 0)
    int fieldId_RecId = TableDataFieldMetadata.FieldNum("DocuRef", "RecId");
    TableMetadata tblMetadata = MetadataCache.GetTableMetadata("DocuRef");

    Dictionary<int, object> dictRecId = new Dictionary<int, object>();
    dictRecId.Add(fieldId_RecId, docuRefRecId);

    AxTableDataKey tblKey = AxTableDataKey.Create(tblMetadata, dictRecId, null);

    menuItem.MenuItemContext = AxTableContext.Create((IAxTableRowKey)tblKey);

    DialogHelper.Navigate(menuItem, this);

No comments:

Post a Comment