Skip to main content
Solved

The multi-part identifier Error

  • February 26, 2026
  • 4 replies
  • 87 views

Jhon Reeve Penuela
Freshman II
Forum|alt.badge.img

Hi Everyone.

Currently I encounter error while. executing my custom button name “Create TP Number”.

 

and here my sample code.

public static void CreateTPNumber(PMQuoteMaint pMQuoteMaint)
{
using (var ts = new PXTransactionScope())
{
PXResultset<CROpportunityProducts> pXResultsetCROpportunityProducts = pMQuoteMaint.Products.Select();

PXResultset<PMQuoteTask> pXResultsetPMQuoteTask = pMQuoteMaint.Tasks.Select();

List<CROpportunityProducts> cROpportunityProductsDuplicate = pXResultsetCROpportunityProducts
.RowCast<CROpportunityProducts>()
.GroupBy(x => new { x.InventoryID, x.TaskCD }).Where(g => g.Count() > 1)
.SelectMany(g => g)
.ToList();

if (cROpportunityProductsDuplicate.Count() > 0)
{
foreach (CROpportunityProducts pMQuoteTask in cROpportunityProductsDuplicate)
{

InventoryItem pXResultInventoryItem = SelectFrom<InventoryItem>.Where<InventoryItem.inventoryID
.IsEqual<@P.AsInt>>.View.Select(pMQuoteMaint, pMQuoteTask.InventoryID).FirstOrDefault();

throw new PXException(Messages.TravelPackageErrorMessageDuplicate(pXResultInventoryItem.InventoryCD));
}
}

if (pXResultsetCROpportunityProducts.Count <= 0 && pXResultsetPMQuoteTask.Count <= 0) return;

foreach (CROpportunityProducts cROpportunityProduct in pXResultsetCROpportunityProducts)
{
CROpportunityProductsExtension cROpportunityProductsExtensions =
PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExtension>(cROpportunityProduct);

if (cROpportunityProductsExtensions == null) return;

string status = cROpportunityProductsExtensions.UsrStatus ?? String.Empty;

if (status == Messages.openStatus
&& cROpportunityProduct.TaskCD == null)
{
InventoryItem inventoryItem = SelectFrom<InventoryItem>.Where<InventoryItem.inventoryID
.IsEqual<@P.AsInt>>.View.Select(pMQuoteMaint, cROpportunityProduct.InventoryID).FirstOrDefault();

if (inventoryItem == null) return;

for (int i = 0; i < cROpportunityProduct.Qty; i++)
{
PMQuoteTask pMQuoteTaskNew = new PMQuoteTask();

pMQuoteTaskNew.Description = inventoryItem.InventoryCD;

pMQuoteMaint.Tasks.Update(pMQuoteTaskNew);

pMQuoteMaint.Actions.PressSave();
}

pMQuoteMaint.Products.Delete(cROpportunityProduct);

foreach (PMQuoteTask pMQuoteTask in pMQuoteMaint.Tasks.Select().RowCast<PMQuoteTask>()
.Where(x => x.Description == inventoryItem.InventoryCD))
{
bool isTaskCD = pXResultsetCROpportunityProducts
.RowCast<CROpportunityProducts>().Where(x => x.TaskCD == pMQuoteTask.TaskCD).Any();

if (!isTaskCD)
{
CROpportunityProducts cROpportunityProductsNew = new CROpportunityProducts();

CROpportunityProductsExtension cROpportunityProductsExtension = PXCache<CROpportunityProducts>
.GetExtension<CROpportunityProductsExtension>(cROpportunityProduct);

CROpportunityProductsExtension cROpportunityProductsExtensionNew = PXCache<CROpportunityProducts>
.GetExtension<CROpportunityProductsExtension>(cROpportunityProductsNew);

cROpportunityProductsNew.InventoryID = inventoryItem.InventoryID;

cROpportunityProductsNew.Qty = 1;

cROpportunityProductsExtensionNew.UsrSuggestedMinimumBid = cROpportunityProductsExtension.UsrSuggestedMinimumBid;

cROpportunityProductsNew.TaskCD = pMQuoteTask.TaskCD;

pMQuoteMaint.Products.Update(cROpportunityProductsNew);
}
}
}
}

pMQuoteMaint.Actions.PressSave();

ts.Complete();
}
}
I hope you can help me. Thanks.

Best answer by Jhon Reeve Penuela

Hi ​@Josiah Lisle and ​@MaheshLakum. Thank you for your time. I already figure out my problem. on my code.

 PXLongOperation.StartOperation

I need to use a 

PXLongOperation.WaitCompletion(Base.UID);

to able to have blocking wait.

4 replies

  • Freshman II
  • February 28, 2026

@Jhon Reeve Penuela 
The CreateTPNumber method itself is not referencing CROpportunityRevision or ManualTotalEntry, so it is unlikely to be the direct cause of the error.

Since the error is occurring on standard base fields of CROpportunityRevision and CROpportunity, it usually indicates that another customization/code is affecting how the PMQuoteMaint screen builds its query (for example, a DAC extension or a graph extension modifying views or attributes).

Could you please check whether you have any other customizations/code related to:

PMQuoteMaint

CROpportunityRevision

CROpportunity

Especially any DAC extensions, CacheAttached events, or modifications to views?

If possible, please share that related code so we can analyze further. Hope that helps.


Jhon Reeve Penuela
Freshman II
Forum|alt.badge.img

Hi ​@MaheshLakum . Thank you for your reply. I forgot to mention. the error doesn’t come out often. there was an error, but the entire process of customization was not affected. it works. but on the client side it's not good to see that and say that it works.


Forum|alt.badge.img+2
  • Jr Varsity I
  • March 2, 2026

Hi ​@MaheshLakum . Thank you for your reply. I forgot to mention. the error doesn’t come out often. there was an error, but the entire process of customization was not affected. it works. but on the client side it's not good to see that and say that it works.

Have you debugged to see where the error is coming up?

I don’t know if this would be the issue, but the Products view is : PXOrderedSelect<PMQuote, CROpportunityProducts, Where<CR.CROpportunityProducts.quoteID, Equal<Current<PMQuote.quoteID>>>,
            OrderBy<Asc<CR.CROpportunityProducts.sortOrder>»

Could it be possible that it doesn’t like your select statement: PXResultset<CROpportunityProducts> pXResultsetCROpportunityProducts = pMQuoteMaint.Products.Select(); or something similar? I have seen some issues before with PXResultSet using the wrong type, but that was in a slightly different situation.


Jhon Reeve Penuela
Freshman II
Forum|alt.badge.img

Hi ​@Josiah Lisle and ​@MaheshLakum. Thank you for your time. I already figure out my problem. on my code.

 PXLongOperation.StartOperation

I need to use a 

PXLongOperation.WaitCompletion(Base.UID);

to able to have blocking wait.