Skip to main content
Solved

Display of Task ID Values in Custom Field 'Revenue Task' on Project Screen


Forum|alt.badge.img+10

Hi Team,

In the project screen, specifically in the Revenue Budget tab, I've included a custom field named "Revenue Task." I want this custom field to display values from the Task ID field in the Task tab. The current selector setup shows the value, but it only appears after saving the project. However, I need the selector value in the custom field to display before the project is saved.

Here is my code:

 public class PMBudgetExt : PXCacheExtension<PX.Objects.PM.PMBudget>
  {
    #region UsrRevenueTask

[PXDBInt]
[PXUIField(DisplayName = "Revenue Task")]
[PXSelector(
    typeof(Search<PMTask.taskID,
        Where<PMTask.projectID, Equal<Current<PMRevenueBudget.projectID>>>>),
    typeof(PMTask.taskCD),
    typeof(PMTask.description),
    SubstituteKey = typeof(PMTask.taskID))]
[PXFormula(typeof(Default<PMRevenueBudget.projectID>))]
public virtual int? UsrRevenueTask { get; set; }
public abstract class usrRevenueTask : PX.Data.BQL.BqlInt.Field<usrRevenueTask> { }

        #endregion




    }

Thanks, in advance!

Regards,

Sweta

Best answer by Django

If I’m understanding correctly, your selector is not pulling the new record because it is still in the cache and not yet committed to the database. I think that you need to add DirtyRead = true to your PXSelector as per this blog post.

https://asiablog.acumatica.com/2018/04/pxselector-and-dirtyread.html

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

aaghaei
Captain II
Forum|alt.badge.img+9
  • Captain II
  • November 18, 2023

In your page set the field CommitChanges = true


Forum|alt.badge.img+10
  • Semi-Pro III
  • November 19, 2023

@aaghaei , 

Also set the field commitchanges=true, then also not getting values display in selector before the save. 

I am getting the selector but in that the values are not displaying before save the project. 

 


aaghaei
Captain II
Forum|alt.badge.img+9
  • Captain II
  • November 19, 2023

I’m not sure why you are duplicating the revenue task when revenue budget already has a task built in. But anyways why don’t you just copy the revenue task and its properties from PMBudget and add a Usr to the beginning and do the same for the page control instead of inventing wheel. 


Forum|alt.badge.img+10
  • Semi-Pro III
  • November 20, 2023

@aaghaei ,  

Thank you for your response.

I'm trying to add the cost-type tasks to my custom selector “CostTask” in the revenue budget tab, but I'm still having trouble with the saving—it only saves after the project is saved.

Below is the image where I have taken the taskid , but in the custom selector of the revenue budget tab, the data isn't showing up. 

 

I checked other standard selectors, and when changes are made in certain fields, the selector gets populated with updated data before saving.

Is I am missing something in custom selector code or need to set the specific properties.

Here is my updated code.

 public class PMBudgetExt : PXCacheExtension<PX.Objects.PM.PMBudget>
    {
        #region UsrRevenueTask
        [PXDBInt]
        [PXUIField(DisplayName = "Revenue Task")]
        [PXSelector(
            typeof(Search<PMTask.taskID,
                Where<PMTask.projectID, Equal<Current<PMRevenueBudget.projectID>>,
                    And<PMTask.type, Equal<ProjectTaskType.cost>>>>),
            typeof(PMTask.taskCD),
            typeof(PMTask.description),
            SubstituteKey = typeof(PMTask.taskCD))]
        [PXFormula(typeof(Default<PMRevenueBudget.projectID>))]
        [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]

        public virtual int? UsrRevenueTask { get; set; }
        public abstract class usrRevenueTask : PX.Data.BQL.BqlInt.Field<usrRevenueTask> { }

        #endregion



    }

I have also set property AutoRefresh= True for the custom field.


Forum|alt.badge.img+5
  • Captain II
  • November 20, 2023

If I’m understanding correctly, your selector is not pulling the new record because it is still in the cache and not yet committed to the database. I think that you need to add DirtyRead = true to your PXSelector as per this blog post.

https://asiablog.acumatica.com/2018/04/pxselector-and-dirtyread.html


aaghaei
Captain II
Forum|alt.badge.img+9
  • Captain II
  • November 20, 2023

Oh this is what you mean. In addition to the dirty read, You will need to set AutoRefresh = True in your page field properties.


Forum|alt.badge.img+10
  • Semi-Pro III
  • November 21, 2023

@Django , @aaghaei ,

Thanks for your response, it has been worked .

Even though the selector displays the data, it's causing an error when I choose something from it, saying that "Revenue Task" can't be found in the system.

After that, when I save it, there aren't any errors displayed. It giving on first time selection.

 


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