Requisition Vendor Info to New Req Detail

Hey all, I am trying out a simple customization to copy the Vendor info on the requisition to new line items based on a checkbox value.

The customization seems to work, but the problem I seem to be running into, is when I go back to look at the cost of the first line item in the req detail, the cost is 0. Is there a better way to do this, or am I overlooking something?

I’m hoping it’s something relatively simple I’m missing! Below is the code that gets called after the GetNewrewDetail adapter.

private static void CopyVendorInfo()
  {
  	if(cbCopyVendor.Checked == true)
  		{
  		EpiDataView edv = (EpiDataView)oTrans.EpiDataViews["ReqDetail"];
  		string vendor = edv.dataView[0]["VendorID"].ToString();
  		int lineCount = edv.dataView.Count;
  		if (lineCount != 0)
  		{
  			for (int i = 0; i < lineCount; i++)
  			{
  				edv.dataView[i]["VendorID"] = vendor;			
  			}
  		}
  	 }
  }

Looks like you are overwriting the vendor on all lines, including the first, in the for loop. Epicor may see this as a reason to zero out the cost on these lines. Maybe filter to the new row only (if RowMod == “A”)?

Also not sure if there is a ChangeVendor method that should be called instead of directly editing the dataSet. Have you done a trace?

Brett

I see a GetVendorInfo method that I can call, but I’m not sure how I would pass in the correct parameter.

I just did a trace on updating the vendor on a req line in 10.2.400. Looks like the GetVendorInfo takes the Requisition dataset as an input.

However I think your issue with the zero price is because Epicor thinks the vendor has changed so it is zeroing out the price. You could try putting an if statement in the for loop to only edit the new row

if (edv.dataView[i]["RowMod"] = "A" )
      edv.dataView[i]["VendorID"] = vendor;

Might be easier / more elegant ways to achieve the same result

Brett

I tried that, seems like it still clears the cost on the line item.