Launch form with current EmpID via code?

Change the mode to “U”

The problem here is that we are trying to force the system to do what we want, which is slightly different than it expects.

Here is what the code wants to do:

	base.LaunchForm(options);
	if (this.LaunchFormOpts != null && this.LaunchFormOpts.ValueIn != null)
	{
		object arg_27_0 = this.LaunchFormOpts.ValueIn;
		base.AutoSubscribe = false;
		if (this.LaunchFormOpts.PublisherKey.ToString().Length > 0)
		{
			this.trans.SubscribeToPublisher(this.LaunchFormOpts.PublisherKey);
		}
		this.FormLoadFromApprovalEntry();
		this.searchValues = null;
		return;
	}
	this.FormLoadFromDefaultEmpID();

So if we give some hashtable params like we are doing, it is doing that proc (.FormLoadFromApprovalEntry). What we really want to happen is that last line FormLoadFromDefaultEmpID(). However, it appears MES isn’t setting the value the form is looking for. Here is what happens:

private void FormLoadFromDefaultEmpID()
{
	string defaultEmpID = this.trans.GetDefaultEmpID();
	if (defaultEmpID != "" && this.trans.GetEmp(defaultEmpID))
	{
		this.trans.empCalendarInfo.SelectedDateRanges.Add(DateTime.Now, 0, true);
	}
}

I assume the issue is that emp is not linked to user or viceversa - that’s the only thing I can gather without debugging it.

1 Like