After we use the Execute() method of the Custom3LookupCmd, how do we return the lookup dialog's selected data? Private Sub btnKnowledgeType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKnowledgeType.Click Dim KnowledgeTypeLookup As New IMANEXTLib.Custom6LookupCmd Dim contextKnowledge As New IMANEXTLib.ContextItems Dim db As IManDatabase db = mSess.Databases.ItemByName("Knowledge") contextKnowledge.Add("ParentWindow", Me) contextKnowledge.Add("IManExt.SelectionDlg.Object", db) KnowledgeTypeLookup.Initialize(contextKnowledge) KnowledgeTypeLookup.Update() If KnowledgeTypeLookup.Status = KnowledgeTypeLookup.Status Or CommandStatus.nrActiveCommand Then KnowledgeTypeLookup.Execute() 'Me.txtKnowledgeType.Text = End If End Sub
This is documented in the manual, Creating Custom Commands in WorkSite: Hijacking Commands: Hijacking a Lookup Button...below Table 11:Returning the Selected Value to the FormYour command can return the selected value back to the form using the following name-value pair in the ContextItems collection:Name: IManExt.SelectedStringType of Value: StringThe form will look for the value stored under this name in the ContextItems collection. If it finds a string, it will stick that string in the corresponding edit field in the form.When returning multiple selections, the string should consist of a list of items delimited by commas.
public override void Execute() { System.Windows.Forms.MessageBox.Show("The command is definitely running"); this.Context.Add("IManExt.SelectedString", "MS-1-1"); this.Context.Add("IManExt.Refresh", true); }