Skip to main content
Solved

Transfer Field from GLTran to PMTran


Forum|alt.badge.img+1

Hello-

I have a custom field that I am trying to transfer from GLTran (Journal Transaction) to PMTran (Project Transaction) when the native conditions are met to create a project transaction on release of Journal Transaction. The issue I’m running into is that that I can’t find a viable method to attach my logic to- I have tried FieldUpdated and RowPersisting on the RegisterEntryGraph to no avail- releasing the Journal Transaction does not trigger any of the events. Anybody have any suggestions on where to tie my logic to transfer this custom field from the GL to the PM? I’m thinking I might have to override the ‘Release’ of the journal entry.. which I would rather avoid if all possible because that adds more complication if the Journal Transaction was created from a separate module first.

Thanks in advance!

Best answer by vardan22

You need to create a graph extension based on an existing extension called JournalEntryProjectExt, which is located in the PX.Objects.PM.GraphExtensions namespace. After this, you need to override the InsertProjectTransaction method.

public class JournalEntryProjectExtExt : PXGraphExtension<JournalEntryProjectExt, JournalEntry>
{
    public static bool IsActive() => true;

    #region PXOverride
    public delegate PMTran InsertProjectTransactionDelegate(PMProject project, PMTask task, PMAccountGroup ag, Account acc, GLTran tran, APTran apTran, ARTran arTran);
    [PXOverride]
    public virtual PMTran InsertProjectTransaction(PMProject project, PMTask task, PMAccountGroup ag, Account acc, GLTran tran, APTran apTran, ARTran arTran, InsertProjectTransactionDelegate insertProject)
    {
        PMTran pmTran = insertProject(project, task, ag, acc, tran, apTran, arTran);
        if (pmTran != null)
        {
            //TODO: Add your custom logic here
        }
        return pmTran;
    }
    #endregion
}

 

View original
Did this topic help you find an answer to your question?

6 replies

vardan22
Jr Varsity III
Forum|alt.badge.img+1
  • Jr Varsity III
  • 44 replies
  • Answer
  • October 14, 2023

You need to create a graph extension based on an existing extension called JournalEntryProjectExt, which is located in the PX.Objects.PM.GraphExtensions namespace. After this, you need to override the InsertProjectTransaction method.

public class JournalEntryProjectExtExt : PXGraphExtension<JournalEntryProjectExt, JournalEntry>
{
    public static bool IsActive() => true;

    #region PXOverride
    public delegate PMTran InsertProjectTransactionDelegate(PMProject project, PMTask task, PMAccountGroup ag, Account acc, GLTran tran, APTran apTran, ARTran arTran);
    [PXOverride]
    public virtual PMTran InsertProjectTransaction(PMProject project, PMTask task, PMAccountGroup ag, Account acc, GLTran tran, APTran apTran, ARTran arTran, InsertProjectTransactionDelegate insertProject)
    {
        PMTran pmTran = insertProject(project, task, ag, acc, tran, apTran, arTran);
        if (pmTran != null)
        {
            //TODO: Add your custom logic here
        }
        return pmTran;
    }
    #endregion
}

 


Forum|alt.badge.img+1
  • Author
  • Varsity III
  • 64 replies
  • October 16, 2023

@vardan22 - I didn’t even know this graph existed, thank you so much! I will give it a shot.


greglang
Varsity I
Forum|alt.badge.img+1
  • Varsity I
  • 61 replies
  • December 1, 2023

Much like the above issue I am trying to copy a Custom field from APTran to PMTran following the normal logic for billable expenses but in my effort to reproduce the logic above I can not seem to fine the right GraphExtention to start with.  I was thinking it would be PX.Objects.AP.APReleaseProcess or PX.Objects.PM.APReleaseProcessExt but can’t seem to find it.  Any help to point me in the right direction would be great.

 

Thanks,

 

 

 


Forum|alt.badge.img
  • Freshman I
  • 12 replies
  • August 12, 2024

@greglang - Did you find the right GraphExtension? I am in the same predicament in trying to move custom field from APTran to PMTran.


aaghaei
Captain II
Forum|alt.badge.img+9
  • Captain II
  • 1178 replies
  • August 12, 2024

I have look into this a while back but if I recall correctly the PMTran is not created directly from subledgers (AP, AR, ...) but it gets created after GLTran is created and that is why no matter from what module you code to a project a Reference to PMTran is retained in GLTran. So you will need to follow the trail from AP to GL and then to PM. If you have a DAC Ext on APTran, in the above overridden method you will need to get the Ext of APTran and then perform your logic. In the InsertProjectTransaction as you can see you have GLTran and APTran to get the extensions you need.


Forum|alt.badge.img
  • Freshman I
  • 12 replies
  • August 12, 2024

@aaghaei - Thank you, I will try to extend the GraphExtension you mentioned.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings