BO System.Guid Property

So, in the UI I’m calling the BO ChangePartNumMaster from the quote adapter.
It requires a guid as a parameter and the trace shows this: <parameter name=“SysRowID” type=“System.Guid”>

This compiles, but is this the proper way to create that guid?
System.Guid sysRowID = new System.Guid(“00000000-0000-0000-0000-000000000000”);

Guid.Empty should work nicely

-Jose

2 Likes

Are you sure you are expected to generate that? Usually Epicor will autogenerate those GUIDs

I couldn’t call the BO without that parameter in there. It wouldn’t compile. I’m assuming Epicor does something that if it’s empty, it will generate a new one? (I hope)

Oh I see, this is a different case. Do you think you’ll get the desired result? Looks like you are going to need to pass a proper SysRowID, not a blank one.

I’d imagine so.
Doing a trace shows that it’s empty, so that seems like the right thing to pass in.

Edit–Apparently not.
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Table: QuoteDtl
Company=‘ISI’ QuoteNum=‘44971’ QuoteLine=‘0’ SysRowID=‘00000000-0000-0000-0000-000000000000’: ForeignKeyConstraint QuoteHedQuoteDtl requires the child key values (ISI, 44971) to exist in the parent table.

**Edit - It looks like this is the line that’s failing: qa.GetNewQuoteDtl((int)edvQuoteHedR[“QuoteNum”]);

I’m attempting to create a new quote line on a button click using this code:

		using( QuoteAdapter qa = new QuoteAdapter(oTrans) )
		{			
			qa.BOConnect();
			qa.GetNewQuoteDtl((int)edvQuoteHedR["QuoteNum"]);
			qa.QuoteData.QuoteDtl[0].QuoteNum = (int)edvQuoteHedR["QuoteNum"];
			qa.QuoteData.QuoteDtl[0].QuoteLine = 0;
			qa.QuoteData.QuoteDtl[0].PartNum = partNum;
			qa.QuoteData.QuoteDtl[0].Company = "ISI";
			qa.QuoteData.QuoteDtl[0].RowMod = "A";
			qa.ChangePartNumMaster(ref partNum,
								   ref lIsPhantom,
								   ref lIsSalesKit,
								   ref uomCode,
								   rowType,
								   sysRowID,
								   salesKitView,
								   removeKitComponents,
								   suppressUserPrompts,
								   runChkPrePartInfo,
								   out vMessage, 
								   out vPMessage, 
								   out vBMessage,
								   out vSubAvail,
								   out vMsgType,
								   getPartXRefInfo,
								   checkChangeKitParent,
								   out cDeleteComponentsMessage,
								   out multipleMatch,
								   out promptToExplodeBOM,
								   out explodeBOMerrMessage);
			qa.ChangePartNum(lSubstitutePartsExist, uomCode);
			qa.Update();
		}

It gives me the “Failed to enable constraints” error followed by an “Object not set to an instance of an object” error, but after all of that, if I refresh the quote, the new line appears. I feel like I’m missing something minor. Any ideas?

You have to have the quote head in the adapter first. Use to adapter to getbyid the relevant head and then your code will probably work

1 Like

I had that same thought as you replied and that did get past the failed constraint.
Now it seems to hit an error “Part is Required” just before the qa.Update() method.
I tried doing this qa.QuoteData.QuoteDtl[0].PartNum = partNum; just before, but it didn’t seem to matter.

		using( QuoteAdapter qa = new QuoteAdapter(oTrans) )
		{			
			qa.BOConnect();
			qa.GetByID((int)edvQuoteHedR["QuoteNum"]);
			qa.GetNewQuoteDtl((int)edvQuoteHedR["QuoteNum"]);
			/*qa.QuoteData.QuoteDtl[0].QuoteNum = (int)edvQuoteHedR["QuoteNum"];
			qa.QuoteData.QuoteDtl[0].QuoteLine = 0;
			qa.QuoteData.QuoteDtl[0].PartNum = partNum;
			qa.QuoteData.QuoteDtl[0].Company = "ISI";*/
			qa.ChangePartNumMaster(ref partNum,
								   ref lIsPhantom,
								   ref lIsSalesKit,
								   ref uomCode,
								   rowType,
								   sysRowID,
								   salesKitView,
								   removeKitComponents,
								   suppressUserPrompts,
								   runChkPrePartInfo,
								   out vMessage, 
								   out vPMessage, 
								   out vBMessage,
								   out vSubAvail,
								   out vMsgType,
								   getPartXRefInfo,
								   checkChangeKitParent,
								   out cDeleteComponentsMessage,
								   out multipleMatch,
								   out promptToExplodeBOM,
								   out explodeBOMerrMessage);
			qa.ChangePartNum(lSubstitutePartsExist, uomCode);
			qa.QuoteData.QuoteDtl[0].PartNum = partNum;
			qa.Update();
		}

Use ChangePartNum (not ChangePartNumMaster) Master is nice but its a pain in the ass

Same issue.

*Edit, you know what, I bet I know what I’m doing wrong. This is the same thing I ran into before. I’m updating [0], but I need to find the proper one to update, don’t I?

**Edit, Yup, that was it. I was updating the wrong index. :expressionless:

1 Like

After I use the BO to create my quote line, is there a way to pull that line into focus?
Right now it adds it, but there’s not much feedback unless I put in a message.
Ideally, I’d like it to behave in a way such that once the line is created, it pulls the user into the Line/Detail view for that line.

Set the .Row = 1, 2, 3 in the corresponding EpidataView.

2 Likes

Beautifully easy.
Thanks again.