update from 2020 r2 to 2022 r2 and got the following error in the following code.
Kindly assist.
All responses will be highly appreciated.
update from 2020 r2 to 2022 r2 and got the following error in the following code.
Kindly assist.
All responses will be highly appreciated.
Searching the source code I can confirm that CRExtensionHelper.cs no longer includes that method. Searching for UpdateServiceOrderHeader reveals it in SM_CRCaseMaint.cs and SM_SOOrderEntry.cs.
You may want to review the source code from 2020 R2 and see how it compares to the methods in the files I mentioned above to see which one you want to reference in your code.
T
Searching the source code I can confirm that CRExtensionHelper.cs no longer includes that method. Searching for UpdateServiceOrderHeader reveals it in SM_CRCaseMaint.cs and SM_SOOrderEntry.cs.
You may want to review the source code from 2020 R2 and see how it compares to the methods in the files I mentioned above to see which one you want to reference in your code.
Thank you for this, really helpful.
This sSM_CRCaseMaint.cs] is the one am supposed to use. Tried to implement it.
I’m getting an error;
See full code below;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using PX.Common;
using PX.Data;
using System.Collections;
using PX.Data.EP;
using PX.Objects.AR;
using PX.Objects.CT;
using PX.Objects.GL;
using PX.Objects.EP;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.SM;
using PX.TM;
using PX.Objects;
using PX.Objects.CR;
using PX.Objects.FS;
using PX.Objects.SM;
namespace PX.Objects.CR
{
public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
{
#region Event Handlers
public PXFilter<FSCreateServiceOrderOnCaseFilter> CreateServiceOrderFilter;
public override void Initialize()
{
this.Base.Action.AddMenuAction(CreateServiceOrders);
base.Initialize();
}
public PXAction<CRCase> CreateServiceOrders;
PXButton]
PXUIField(DisplayName = "Create Service Orders", Visible = true, MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual void createServiceOrders()
{
CRCase crCaseRow = Base.Case.Current;
FSxCRCase fsxCRCaseRow = Base.Case.Cache.GetExtension<FSxCRCase>(crCaseRow);
if (crCaseRow.CustomerID == null && crCaseRow.ContactID == null)
{
throw new PXException("You can not create proceed." + Environment.NewLine + "The Business Account and Contact are NULL.");
}
if (crCaseRow.CustomerID == null)
{
throw new PXException("You can not create proceed." + Environment.NewLine + "The Business Account is NULL.");
}
if (crCaseRow.ContactID == null)
{
throw new PXException("You can not create proceed." + Environment.NewLine + "The ContactID is NULL.");
}
if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
{
fsxCRCaseRow.SDEnabled = true;
fsxCRCaseRow.BranchLocationID = CreateServiceOrderFilter.Current.BranchLocationID;
fsxCRCaseRow.SrvOrdType = CreateServiceOrderFilter.Current.SrvOrdType;
fsxCRCaseRow.AssignedEmpID = CreateServiceOrderFilter.Current.AssignedEmpID;
fsxCRCaseRow.ProblemID = CreateServiceOrderFilter.Current.ProblemID;
PXLongOperation.StartOperation(Base, delegate ()
{
CreateServiceOrderDocument(Base, crCaseRow, CreateServiceOrderFilter.Current);
});
}
}
private void CreateServiceOrderDocument(CRCaseMaint graphCRCaseMaint, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow)
{
if (graphCRCaseMaint == null || crCaseRow == null || fsCreateServiceOrderOnCaseFilterRow == null)
{
return;
}
ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance<ServiceOrderEntry>();
FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(CreateServiceOrderFilter.Current.SrvOrdType, ID.SourceType_ServiceOrder.CASE);
graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);
//CRExtensionHelper.UpdateServiceOrderHeader(
// graphServiceOrderEntry,
// Base.Case.Cache,
// crCaseRow,
// fsCreateServiceOrderOnCaseFilterRow,
// graphServiceOrderEntry.ServiceOrderRecords.Current,
// true);
SM_CRCaseMaint.UpdateServiceOrderHeader(
graphServiceOrderEntry,
Base.Case.Cache,
crCaseRow,
fsCreateServiceOrderOnCaseFilterRow,
graphServiceOrderEntry.ServiceOrderRecords.Current,
true);
//graphServiceOrderEntry.ServiceOrderRecords.Current.SourceID = crCaseRow.CaseCD;
graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crCaseRow.CaseCD;
if (!Base.IsContractBasedAPI)
{
throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
}
}
}
#endregion
}
Searching the source code I can confirm that CRExtensionHelper.cs no longer includes that method. Searching for UpdateServiceOrderHeader reveals it in SM_CRCaseMaint.cs and SM_SOOrderEntry.cs.
You may want to review the source code from 2020 R2 and see how it compares to the methods in the files I mentioned above to see which one you want to reference in your code.
Kindly assist in implementing this i.e SM_CRCaseMaint.cs.
Just having a quick look I see that SM_CRCaseMaint is a Graph Extension of CRCaseMaint. The error message is tell you that you need a variable (object) that is of type SM_CRCaseMaint and then that variable has a method you can call.
Looking at the declaration of your method:
private void CreateServiceOrderDocument(CRCaseMaint graphCRCaseMaint, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow)
I see your first parameter is a variable of type CRCaseMaint.
So I’ll take a guess that you need a line of code something like:
SM_CRCaseMaint caseMaintExt = graphCRCaseMaint.GetExtension<SM_CRCaseMaint>();
caseMaintExt.UpdateServiceOrderHeader(
graphServiceOrderEntry,
Base.Case.Cache,
crCaseRow,
fsCreateServiceOrderOnCaseFilterRow,
graphServiceOrderEntry.ServiceOrderRecords.Current,
true);
I’m not certain but I think this is the direction you need to take.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.