How to pass parameters to Adapter Method

In Epicor 10, In a customization I’m trying to call JobEntryAdapter.ChangeJobHeadJobReleased. I have the following:

using (JobEntryAdapter jobEntryAdapter = new JobEntryAdapter(this.oTrans))
{
	jobEntryAdapter.BOConnect();
	JobEntryDataSet ds = jobEntryAdapter.JobEntryData;

    jobEntryAdapter.ChangeJobHeadJobReleased();
}

The Trace Log says that ChangeJobHeadJobReleased needs a parameter of JobEntryDataSet. However, the ChangeJobHeadJobReleased method doesn’t accept any arguments. How do I pass in the parameter to the method?

You’ve created the adapter instance but you haven’t selected any specific record set. You’ll want to call a GetByID method first before you attempt to call the ChangeJobHedJobReleased method, since it doesn’t know what records to apply that method to.

Hi Aaron, I’ve also tried the following, this does nothing:

		using (JobEntryAdapter jobEntryAdapter = new JobEntryAdapter(this.oTrans))
		{
			jobEntryAdapter.BOConnect();
			JobEntryDataSet ds = jobEntryAdapter.JobEntryData;

			if (jobEntryAdapter.GetByID(jobNumber))
			{
				DataRow dr = jobEntryAdapter.JobEntryData.JobHead.Rows[0];
				dr.BeginEdit();
				dr["JobReleased"] = false;
				dr["RowMod"] = "U";
				dr.EndEdit();

				jobEntryAdapter.ChangeJobHeadJobReleased();
			}
		}

I know nothing about that business object, but in your trace, are there any methods or field changes preceding the ChangeJobHeadJobReleased Method?

If I add jobEntryAdapter.Update(), the job is updated correctly, but it’s now using the Update method instead of the ChangeJobheadJobReleased method so this wasn’t really what I was trying to do.

The Trace Log uses paramDataSetChanges which I don’t understand how to re-create:

  <paramDataSetChanges>
    <paramDataSet name="ds" useDataSetNbr="0">
      <changedValue tableName="JobHead" rowState="Modified" rowNum="0" colName="JobReleased"><![CDATA[False]]></changedValue>
      <changedValue tableName="JobHead" rowState="Modified" rowNum="0" colName="UD_SysRevID"><![CDATA[System.Byte[]]]></changedValue>
    </paramDataSet>
  </paramDataSetChanges>

Did you try updating the adapter after the datarow edits are finished?

From the BO documentation on this method:

Maybe you need to change the value of the JobReleased field before running the method.

It might be helpful if we knew the entire problem / automation that you are attempting to resolve/do… What is supposed to trigger this logic? Are you trying to auto release the job? Where are you putting this?

1 Like
					oTrans.GetByID(jobNum);
					edvJobHeadRow = this.edvJobHead.CurrentDataRow;
					edvJobHeadRow.BeginEdit();
						edvJobHeadRow["JobReleased"] = true;
					edvJobHeadRow.EndEdit();
					oTrans.Update();

Thanks Brian, I do have it working with Update but this does not call ChangeJobHeadJobReleased() the way the Job Entry screen does. I thought it was best practice to call the same methods that are doing actions, rather than just updating the field.

Tim ~ I’m just trying to unrelease a job using a button in a dashboard at this point, and understand how to call these adapters in general.

Aaron ~ if I call the ChangeJobHeadJobReleased after Update(), I get a JobHead has not changed. message, presumably because it has already been updated and now there are no pending changes.

I think you might need to set JobReleased to true/false in your data row edit, call the update method. I’m not sure you need to call that method at all, but I could be wrong. Sometimes I’ve noticed that it’s not always necessary to call every method that the UI would invoke when using the business objects.

Here is how we call it. I am sure there are better ways to do this.

JobEntryAdapter adapterJobEntry = new JobEntryAdapter( this.oTrans );
adapterJobEntry.BOConnect( );

adapterJobEntry.GetByID( strGlobalJobNumber );


DateTime dttmReqDueDate = adapterJobEntry.JobEntryData.JobHead[ 0 ].ReqDueDate;

adapterJobEntry.JobEntryData.JobHead[ 0 ].JobReleased = true;

adapterJobEntry.ChangeJobHeadJobReleased( );

System.Boolean boolResultJobEntryUpdate = adapterJobEntry.Update( );