Skip to main content
Answer

How to get records from Transfer screen in Related Documents Tab?

  • September 9, 2024
  • 1 reply
  • 134 views

Forum|alt.badge.img+1

Hello,

I created a Related Documents Tab in my custom screen Similar to Relations Tab in Opportunities screen.
I added Transfers in Type Column, But Data is not retrieving from Transfers screen.
Pls refer below screenshot.
Is there any sample code for this or where I need to add code for this?


Please suggest any solution for this.

 

Best answer by taras

Hi @Giri K 

On the Relations grid Document field uses EntityIDSelectorAttribute to Search for data. This attribute is looking for target DAC NoteID PXNote attribute. PXNote attribute should contains 2 properties: Selector and ShowInReferenceSelector. I haven’t found a way how to override NoteID attribute but we can override EntityIDSelectorAttribute.
 

 public class EntityIDSelectorExtAttribute : EntityIDSelectorAttribute
{
public EntityIDSelectorExtAttribute(Type typeBqlField) : base(typeBqlField)
{
}

protected override void CreateSelectorView(PXGraph graph, Type itemType, PXNoteAttribute noteAtt, out string viewName, out string[] fieldList, out string[] headerList)
{
if (itemType == typeof(INRegister))
{
noteAtt.Selector = typeof(Search<INRegister.refNbr, Where<INRegister.docType, Equal<INDocType.transfer>>>);
noteAtt.ShowInReferenceSelector = true;
}
base.CreateSelectorView(graph, itemType, noteAtt, out viewName, out fieldList, out headerList);
}
}
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class OpportunityExt : PXGraphExtension<OpportunityMaint_CRRelationDetailsExt, OpportunityMaint>
{
public PXSelect<INRegister> INRegister_Dummy;

[EntityIDSelectorExtAttribute(typeof(CRRelation.targetType))]
[PXMergeAttributes(Method = MergeMethod.Merge)]
protected virtual void _(Events.CacheAttached<CRRelation.targetNoteID> e) { }


[CRRelationDetail(
statusField: typeof(INRegister.status),
descriptionField: typeof(INRegister.tranDesc),
ownerField: null,
documentDateField: typeof(INRegister.tranDate))]
[PXMergeAttributes(Method = MergeMethod.Append)]
protected virtual void _(Events.CacheAttached<INRegister.refNbr> e) { }
}

 

1 reply

Forum|alt.badge.img+1
  • Jr Varsity I
  • Answer
  • September 11, 2024

Hi @Giri K 

On the Relations grid Document field uses EntityIDSelectorAttribute to Search for data. This attribute is looking for target DAC NoteID PXNote attribute. PXNote attribute should contains 2 properties: Selector and ShowInReferenceSelector. I haven’t found a way how to override NoteID attribute but we can override EntityIDSelectorAttribute.
 

 public class EntityIDSelectorExtAttribute : EntityIDSelectorAttribute
{
public EntityIDSelectorExtAttribute(Type typeBqlField) : base(typeBqlField)
{
}

protected override void CreateSelectorView(PXGraph graph, Type itemType, PXNoteAttribute noteAtt, out string viewName, out string[] fieldList, out string[] headerList)
{
if (itemType == typeof(INRegister))
{
noteAtt.Selector = typeof(Search<INRegister.refNbr, Where<INRegister.docType, Equal<INDocType.transfer>>>);
noteAtt.ShowInReferenceSelector = true;
}
base.CreateSelectorView(graph, itemType, noteAtt, out viewName, out fieldList, out headerList);
}
}
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class OpportunityExt : PXGraphExtension<OpportunityMaint_CRRelationDetailsExt, OpportunityMaint>
{
public PXSelect<INRegister> INRegister_Dummy;

[EntityIDSelectorExtAttribute(typeof(CRRelation.targetType))]
[PXMergeAttributes(Method = MergeMethod.Merge)]
protected virtual void _(Events.CacheAttached<CRRelation.targetNoteID> e) { }


[CRRelationDetail(
statusField: typeof(INRegister.status),
descriptionField: typeof(INRegister.tranDesc),
ownerField: null,
documentDateField: typeof(INRegister.tranDate))]
[PXMergeAttributes(Method = MergeMethod.Append)]
protected virtual void _(Events.CacheAttached<INRegister.refNbr> e) { }
}