How can I hide only the option 'Open with -> Job Entry' to replace it with my own 'Open with -> Job Entry'?

So, I successfully added an option to ‘Open with’ when I right click on JobHead_JobNum. The problem is that I now want to hide the original ‘Open with Job Entry’ which is still there. How can I hide it?

I can’t delete the option because I get this error:

I have this code:

private void MainController_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		// Add custom Job Entry when right clicking on a job number
		oTrans.RegisterContextHandler("V_Q_ProjectTrackerJobs_1View1.JobHead_JobNum", "Job Entry", new EpiTransaction.ContextClicked(OpenJob));
	}

	private object OpenJob(object sender, object currentValue)
	{
	    using (oTrans.PushDisposableStatusText(EpiString.GetString("retrievingData"), true))
	    {
	        try
	        {
				EpiDataView viewJobs = ((EpiDataView)(this.oTrans.EpiDataViews["V_Q_ProjectTrackerJobs_1View1"]));
				string jobID = viewJobs.dataView[viewJobs.Row]["JobHead_JobNum"].ToString();
				string plantID = viewJobs.dataView[viewJobs.Row]["Plant_Plant"].ToString();
	            NameValueCollection options = new NameValueCollection()
				{
				    { "JobNumber", jobID },
					{ "Request", "OpenJob"},
				};
				LaunchFormOptions lfo = new LaunchFormOptions();
				lfo.ContextValue = options;
				//get session
				Ice.Core.Session ss=(Ice.Core.Session)MainController.Session;
				string originalSiteID = ss.PlantID; //get site
				ss.PlantID = plantID;
				ProcessCaller.LaunchForm(oTrans, "PJGO1010", lfo); //open job entry form
				ss.PlantID = originalSiteID; //set back to original site
	        }
            catch (Exception ex)
        {
            ExceptionBox.Show(ex);
        }
    }
    return "";
}

You can override the Open With by using something like this and change for handling your specific field and data view. You can create a context menu that could be specific for this one customization. There are other ways to do this as well. This example - if you don’t create a Context Menu - will show no Open With on PODetail.

			EpiDataView edvPODetail = (EpiDataView)(this.oTrans.EpiDataViews["PODetail"]);
			edvPODetail.dataView.Table.Columns["PartNum"].ExtendedProperties["EpiContextMenuKey"] = "MyPart"; 
			edvPODetail.dataView.Table.Columns["PartNum"].ExtendedProperties["EpiKeyField"] = true; 
			edvPODetail.dataView.Table.Columns["PartNum"].ExtendedProperties["Like"] = "MyPart";

Assuming you want your OpenWith to open all Job contexts… just use Process Calling Maintenance

I want to ‘Open With’ my Job Entry but I need to execute a bit of code before.

I’m just saying, if you intend for this bit o code to happen with ANY JobEntry open, create a customization for it, then have the default call to JobEntry modified in Process Calling Maintenance.

Nope, for now, I only want this code to be executed from my Project Dashboard, thanks for the solution anyway

You should be able to include a check in the customization to view the caller, and only execute your logic when that particular form is the caller.

1 Like