Solved

Using Selector functionality in Case ID field on Employee Time Activities

  • 8 February 2023
  • 6 replies
  • 118 views

Hi all,

I am trying to use a Selector functionality to choose a Case ID when I am filling the grid on Employee Time Activities, but this field is disabled to edit in that grid.

Following is the attributes customized CaseCD existing field

[PXDBString(15, IsUnicode = true, IsKey = true, InputMask = ">CCCCCCCCCCCCCCC")]
[PXDefault()]
[PXUIField(DisplayName = "Case ID", Visibility = PXUIVisibility.SelectorVisible)]
[PXSelector(typeof(Search2<CRCase.caseCD,
LeftJoin<BAccount, On<BAccount.bAccountID, Equal<CRCase.customerID>>>, 
Where<BAccount.bAccountID, IsNull, Or<Match<BAccount, Current<AccessInfo.userName>>>>,
OrderBy<Desc<CRCase.caseCD>>>),
typeof(CRCase.caseCD),
typeof(CRCase.subject),
typeof(CRCase.status),
typeof(CRCase.priority),
typeof(CRCase.severity),
typeof(CRCase.caseClassID),
typeof(CRCase.isActive),
typeof(BAccount.acctName))]

 

I know that is possible to fill this information using the Cases form (CR306000) in the Activities tab, but in my workflow will be better if I can do this relationship direct in this screen.

 

Someone could give me some idea if is it possible?

 

Thankyou!

icon

Best answer by joaomarin 22 March 2023, 03:33

View original

6 replies

Userlevel 3
Badge

Hi Jo

 

The default link to the Case for a PMTimeActivity record is via the CRActivity - via the RefNoteID

I suspect that if the RefNoteID is null then this field is not enabled.

 

 

#region RefNoteID
        public abstract class refNoteID : PX.Data.BQL.BqlGuid.Field<refNoteID> { }

        [PXSequentialSelfRefNote(SuppressActivitiesCount = true, NoteField = typeof(noteID))]
        [PXUIField(Visible = false)]
        [PXParent(typeof(Select<CRActivity, Where<CRActivity.noteID, Equal<Current<refNoteID>>>>), ParentCreate = true)]
        public virtual Guid? RefNoteID { get; set; }
        #endregion

 

Hi @gprice27 tank you for your reply.

 

I checked in the PMTimeActivity table in the database and the RefNoteID field is not null.

 

As you can see below, the Case ID field is populated when I link the activity through the cases form.
But I would like to be able to assign the Case to the Activity through this form, but in the first line the field is disabled.

 

I also checked that the RefNoteID field properties you pointed out are the default properties.

Is there anything I can change to make the field changeable by the user?

 

Thank you again.

Userlevel 7
Badge

Hi @joaomarin  were you able to find a solution? Thank you!

Userlevel 3
Badge

Hey Jo

You could try enabling the RefNoteID field on the RowSelected Event (you will need a graph extension)

This ‘’MAY’ expose a default selector… not sure...

If you look at the code - the link from EPActivityApprove (the grid’s DAC) and CRCase is LeftJoin<CRActivityLink, 
                    On<CRActivityLink.noteID, Equal<EPActivityApprove.refNoteID>>,
                LeftJoin<CRCase, 
                    On<CRCase.noteID, Equal<CRActivityLink.refNoteID>>,

CRActivityLink is actually an internal projection which Acumatica uses to link the Case to the Activity ( ensuring that the RefnoteID is not null etc…

So - if you want to try it you could just populate the EPActivityApprove.RefNoteID with the selected CRCase.NoteID and it should work

You will have to build a custom selector attribute for this - and add it to the RefNoteID field on the Graph Extension Cache Attached event.

Hi guys!

 

Thanks for your response @gprice27!

 

In truth I solved this issue pratically by this way.

 

I created a customized field to get the case CD, and I implemented the code below in a Row Updated event.

if (rowExt.UsrCaseCD != null)
{
CRCase caseLinked = SelectFrom<CRCase>.Where<CRCase.caseCD.IsEqual<@P.AsString>>.View.Select(this.Base, rowExt.UsrCaseCD);

if (caseLinked != null)
{
cRActivity.RefNoteID = caseLinked.NoteID;
}
}

The drawback in my opinion is that I have two columns in the table with the same information. One for the user to manipulate and another to serve as a link to the Case, but worked.

 

 

Userlevel 7
Badge

Thank you for sharing your solution with the community @joaomarin !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved