Solved

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

  • 18 November 2023
  • 7 replies
  • 115 views

Userlevel 7
Badge +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

icon

Best answer by Django 20 November 2023, 16:39

View original

7 replies

Userlevel 7
Badge +8

In your page set the field CommitChanges = true

Userlevel 7
Badge +10

@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. 

 

Userlevel 7
Badge +8

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. 

Userlevel 7
Badge +10

@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.

Userlevel 7
Badge +5

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

Userlevel 7
Badge +8

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

Userlevel 7
Badge +10

@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


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