Skip to main content

Hi Team,

We would like to implement the following feature.

When entering a customer on the Case screen => If that customer has had previous Cases => the system automatically add previous historical Cases of the same customer on the "RELATED CASES" TAB  and those historical cases are arranged in CreatedDateTime of Cases.

 

 

I created Event RowInserted but haven't achieved results yet.
Please advise how to do this.

 

Note: Acumatica Version 2020R1

 

Best Regatrds,

NNT

 

//////////////////////////////////////////////////////

namespace PX.Objects.CR
{
  public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
  {
    #region Event Handlers
   protected void CRCaseReference_RowInserted(PXCache cache, PXRowInsertedEventArgs e, PXRowInserted InvokeBaseHandler)
    {
      if(InvokeBaseHandler != null)
        InvokeBaseHandler(cache, e);
      var row = (CRCaseReference)e.Row;
            if (row == null)
            {
                return;
            }

            CRCase rRCa = Base.Case.Current;

            CRCase cRCase = PXSelect<CRCase,
                Where<CRCase.customerID, Equal<Required<CRCase.customerID>>>>.Select(Base, rRCa.CustomerID);
            if (cRCase == null) { return; }

            cache.SetValueExt<CRCaseReference.childCaseCD>(row, cRCase.CaseCD);
            cache.Update(row);
      
    }

    
    #endregion
  }
}

 

//////////////////////////////////////////////////////

 

This would be beyond my programming knowledge but you could use a Sidepanel action on the screen to show this information. Just a suggestion which you may have already considered


I agree with @dcomerford to go for a side panel instead of customization in this case.


Hi @dcomerford , @ChandraM 

Please guide me in detail how to do it

Best Regatrds,

NNT

 


@nhatnghetinh 

Create a GI to show Case details or use the existing one it must be visilbe on the UI. Ensure the Business Account is on it as you will need that for the filter

Add an Action to the Case Screen in a customisation package as follows and publish

Open Case screen and you will see it to the RHS (by creating your own GI you can decide which fields you want to see etc.

 


Hi @dcomerford

When selecting a customer on the Case screen and the Case has not been saved, the Side panel does not display the information.

 

How when selecting a customer on the Case screen and not saving the Case => Side panel still displays information ?

 

Best Regards,

NNT


@nhatnghetinh Correct the record has to be saved for the side panel to work


Hi @nhatnghetinh Here is the Customization package built for you with the side panels solution. The version used is Acumatica 2023R1 build 105

Result:
 



 


Hi @dcomerford , @ChandraM 

How to exclude current Case from Side panel list?

 

Best Regards,

NNT


Hi @nhatnghetinh A conditional logic cannot be added to the side panel. only Parameter Value can be passed to the side panel.

I think this could be adjusted in a generic Inquiry. You could have a new Generic Inquiry with a Parameter “CaseID” to show all the Cases except the one shown in the Parameter.

 


Hi @nhatnghetinh,

To display all case from the customer in the Related Case, you can redefine the CaseRefs view of the graph extension like below, where you select cases from the Customer 

	public class CRCaseMaint_Extension : PXGraphExtension<PX.Objects.CR.CRCaseMaint>
{
#region Event Handlers

PXViewName(Messages.CaseReferences)]
public PXSelect<CRCase, Where<CRCase.customerID, Equal<Current<CRCase.customerID>>>>
CaseRefs;
#endregion
}

Then you need update the DataField value of the each field in the grid to display the column(from CRCase DAC) value as required. Below is an example,

 

Like above I set the DataField for Subject and Status, below is the outcome,

 

I have attached the customization package for reference. Happy Customizing Acumatica.!!


Hi @Vignesh Ponnusamy,

Thank you very much for the solution to my question.
I have tested this customization but there is a problem that we can not add new row to TAB “RELATED CASES” with any Case like the previous existing feature.

My wish for this feature is that the system automatically adds Cases with the same customer, but we can still add new rows or remove rows that the system automatically adds.

 

 

Best Regards,

NNT


Hi @nhatnghetinh,

Glad that helped.!

To be able to add the cases on the go, in the CRCaseMaint extension you can try override the caseRefs Data Handler to match your requirement.

protected virtual IEnumerable caseRefs()
{
var currentCaseCd = Case.Current.With(_ => _.CaseCD);
if (currentCaseCd == null) yield break;

var ht = new HybridDictionary();
foreach (CRCaseReference item in
PXSelect<CRCaseReference,
Where<CRCaseReference.parentCaseCD, Equal<Required<CRCaseReference.parentCaseCD>>>>.
Select(this, currentCaseCd))
{
var childCaseCd = item.ChildCaseCD ?? string.Empty;
if (ht.Contains(childCaseCd)) continue;

ht.Add(childCaseCd, item);
var relCase = SelectCase(childCaseCd);
if (relCase == null)
continue;

/* PXUIFieldAttribute.SetEnabled<CRCaseRelated.status>(CaseRelated.Cache, relCase, false);
PXUIFieldAttribute.SetEnabled<CRCaseRelated.ownerID>(CaseRelated.Cache, relCase, false);
PXUIFieldAttribute.SetEnabled<CRCaseRelated.workgroupID>(CaseRelated.Cache, relCase, false);*/

yield return new PXResult<CRCaseReference, CRCaseRelated>(item, relCase);
}

var cache = CaseRefs.Cache;
var oldIsDirty = cache.IsDirty;

foreach (CRCaseReference item in
PXSelect<CRCaseReference,
Where<CRCaseReference.childCaseCD, Equal<Required<CRCaseReference.childCaseCD>>>>.
Select(this, currentCaseCd))
{
var parentCaseCd = item.ParentCaseCD ?? string.Empty;
if (ht.Contains(parentCaseCd)) continue;
var relCase = SelectCase(parentCaseCd);
if(relCase == null)
continue;

ht.Add(parentCaseCd, item);
cache.Delete(item);
var newItem = (CRCaseReference)cache.CreateInstance();
newItem.ParentCaseCD = currentCaseCd;
newItem.ChildCaseCD = parentCaseCd;

switch (item.RelationType)
{
case CaseRelationTypeAttribute._DEPENDS_ON_VALUE:
newItem.RelationType = CaseRelationTypeAttribute._BLOCKS_VALUE;
break;
case CaseRelationTypeAttribute._DUBLICATE_OF_VALUE:
newItem.RelationType = CaseRelationTypeAttribute._DUBLICATE_OF_VALUE;
break;
case CaseRelationTypeAttribute._RELATED_VALUE:
newItem.RelationType = CaseRelationTypeAttribute._RELATED_VALUE;
break;
default:
newItem.RelationType = CaseRelationTypeAttribute._DEPENDS_ON_VALUE;
break;
}

newItem = (CRCaseReference)cache.Insert(newItem);
cache.IsDirty = oldIsDirty;
yield return new PXResult<CRCaseReference, CRCaseRelated>(newItem, relCase);
}
}

I think it could get tricky, but you can give it a shot. Hope that helps and good luck.!


Hi @Vignesh Ponnusamy,

I tried to Publish Current Project but got the following error message:

=============================================

IIS APPPOOL\DefaultAppPool
Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\CRCaseMaint.cs(37): error CS0305: Using the generic type 'Case<Where_, Operand>' requires 2 type arguments
\App_RuntimeCode\CRCaseMaint.cs(50): error CS0103: The name 'SelectCase' does not exist in the current context
\App_RuntimeCode\CRCaseMaint.cs(71): error CS0103: The name 'SelectCase' does not exist in the current context
\App_RuntimeCode\CRCaseMaint.cs(37): error CS0305: Using the generic type 'Case<Where_, Operand>' requires 2 type arguments
Compiler time, in seconds: 3.948062
 
Validation failed.

===================================================

 

Best Regards,

NNT

 


Hi @nhatnghetinh, Try using Base.SelectCase.

SelectCase is in the actual graph, so to access it from the Graph Extension you can use Base.


Reply