I tried following the instructions from the link below to create a hyperlink in a grid; however, I am receiving an error message during validation/compile, (error message below. The code snippet also here shows what I have written.
error CS0029: Cannot implicitly convert type 'CustomerCasesTab.CRCase' to 'PX.Objects.CR.CRCase'
Does anyone have some direction on what I have done wrong here?
Page 1 / 1
What line is the error message indicating is the problem? I suspect the first line in the method. You might just need to change it to:
var row = CasesGraphView.Current;
the easiest way to use the hyperlink. Here are some tips.
Simple you must add this example, so that you no longer do many jobs.
1. inside Dac you must use pxselector and then call you and it will create a hyperlink.
#region RefNbr PXDBString(15, IsUnicode = true, IsKey = true)] bPXUIField(DisplayName = "Referencia")] iPXSelector(typeof(Search<APRegister.refNbr>))] public virtual string RefNbr { get; set; } public abstract class refNbr : PX.Data.BQL.BqlString.Field<refNbr> { } #endregion
Step 2
3.- Result
Django, My apologies. The statement that is failing is
graph.Case.Current = casenbr;
Setting “var row = CasesGraphView.Current();” made no difference.
I realized I probably should include the full code as the error message references the namespace. Here is the full code of customization.
Again, the validation/compiler is failing on the statement graph.Case.Current = casenbr;
Thank you!
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using PX.Api; using PX.Common; using PX.Data; using PX.SM; using PX.Objects.AR.CCPaymentProcessing; using PX.Objects.AR.Repositories; using PX.Objects.Common; using PX.Objects.Common.Discount; using PX.Objects.CA; using PX.Objects.CM; using PX.Objects.CR; using PX.Objects.CR.Extensions; using PX.Objects.CS; using PX.Objects.SO; using PX.Objects.AR.CCPaymentProcessing.Helpers; using PX.Data.BQL.Fluent; using PX.Data.BQL; using PX.Data.Descriptor; using CashAccountAttribute = PX.Objects.GL.CashAccountAttribute; using PX.Objects.GL.Helpers; using PX.Objects.TX; using PX.Objects.IN; using PX.Objects.CR.Extensions.Relational; using PX.Objects.CR.Extensions.CRCreateActions; using PX.Objects.GDPR; using PX.Objects.GraphExtensions.ExtendBAccount; using PX.Data.ReferentialIntegrity.Attributes; using CRLocation = PX.Objects.CR.Standalone.Location; using PX.Objects; using PX.Objects.AR;
namespace CustomerCasesTab
{ public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint> { #region Selects
public PXSelect<CRCase, Where<CRCase.customerID, Equal<Current<Customer.bAccountID>>>> CasesGraphView;
if (graph.Case.Current != null) { throw new PXRedirectRequiredException(graph, true, "Cases"); }
}
} }
Hmmm… not sure. You might want to check that your view’s CRCase is indeed the same as the CRCase that the graph is expecting. There might be two different declarations and you need to force your declaration to match. Something like PX.Objects.CR.Standalone.CRCase (this is a guess). If you enter your code in Visual Studio, it should be table to tell you where it thinks that the declaration is coming from.
As an aside, I would recommend changing that code to make use of the PK function/method. I find it to behave better than PXSelect.
CRCase casenbr = CRCase.PK.Find(Base,row.Casecd);
error CS0029: Cannot implicitly convert type 'CustomerCasesTab.CRCase' to 'PX.Objects.CR.CRCase'
Does anyone have some direction on what I have done wrong here?
CustomerCasesTab.CRCase makes it sound like you have a class called CRCase defined within your namespace. Is there any chance it’s referencing a different code file in the customization package?
Also, that’s an incredible amount of references. In my experience, they do nothing but cause issues. I’d work through commenting a bunch out at a time until you have just what you need, or if you’re using Visual Studio, use the ‘Remove and sort usings’.
@darylbowman Yeah, I agree about those references. They were added before I picked up this customization by someone else. I will try and clean those up once I have solved this issue.
In this particular customization there is a new DAC, which appears to have been created from CRCase originally. I can post it here if you think there is value in looking to see if that is part of the issue.
Thank you for your help,
I'm guessing that's exactly what's wrong. You are trying to assign a custom CRCase to the CR.CRCase view's Current property. That's not gunna work.
You could specify the variable declaration to be of type PX.Objects.CR.CRCase.
@darylbowman Ah, that makes perfect sense. Where would that PX.Objects.CR.CRCase. go? Or should I look to rewrite this changing the namespace to “namespace PX.Objects.CR”? Which would be the better way to go?
I believe that anywhere you use CRCase, the compiler is going to use your custom class, since that is "closer", being in your namespace rather than in a referenced library.
If you can't eliminate the custom class, you could do something like a
using BaseCase = PX.Objects.CR.CRCase;
(at the top with the other 'usings')
Then replace CRCase with BaseCase wherever you use it.
I went ahead and completely rewrote that entire customization and even cleaned up the references. Using a new namespace corrected my error and I was able to complete a hyperlink creation for the grid.