Solved

Default Values in Convert to Project Dialog/Popup

  • 3 March 2022
  • 3 replies
  • 128 views

Userlevel 1
Badge

I want to default 4 checkboxes (Activate Project, Activate Tasks, Copy Notes to Project, Copy Files to Project) to “checked” in the Convert to Project dialog/popup on the Project Quotes page. I’ve added “[PXUnboundDefault(true)]” to the Attributes for each of those 4 items, but it only works for the two “Activate” items; the two “Copy” items aren’t affected. Any ideas how to default the “Copy” checkboxes to true? Bonus points if you can tell me how to automatically click to OK button to submit the dialog. Thanks in advance!

 

 

icon

Best answer by darylbowman 3 March 2022, 16:56

View original

3 replies

Badge +10

I think the reason is because the ‘ConvertToProject’ action in PMQuoteMaint manually sets those values:

public PXAction<PMQuote> convertToProject;
[PXUIField(DisplayName = "Convert to Project", MapEnableRights = PXCacheRights.Select)]
[PXButton(Category = Messages.Processing, DisplayOnMainToolbar = true, IsLockedOnToolbar = true)]
public IEnumerable ConvertToProject(PXAdapter adapter)
{
List<PMQuote> list = new List<PMQuote>(adapter.Get().Cast<PMQuote>());

this.Save.Press();

// **Resets the values to 'default' (I think; really can't explain why this is necessary)
if (ConvertQuoteInfo.View.Answer == WebDialogResult.None)
{
ConvertQuoteInfo.Cache.Clear();
var settings = ConvertQuoteInfo.Cache.Insert() as ConvertToProjectFilter;
settings.CopyNotes = false; // here
settings.CopyFiles = false; // and here
settings.MoveActivities = false;
settings.TaskCD = GetDefaultTaskCD();
}

bool failed = false;
foreach (PMQuote quote in list)
{
if (!ValidateQuoteBeforeConvertToProject(quote))
failed = true;
}

if (failed)
return list;

// **Opens the dialog
if (ConvertQuoteInfo.AskExt() != WebDialogResult.Yes)
return list;

// more code...
}

Edit:

I’m not sure this is true after all. It looks like this would be happening only in the case of no dialog result.

@Chris Hackett  I really need to be able to delete these posts 🤦🏻‍♂️

 

Edit again:

I think this is correct. The first section seems to be resetting the values to default for some reason, although I can’t explain why that would be needed. Seems unnecessary.

The actually dialog call is further down.

I’m afraid I don’t have any good methods to change this. Seems like you’d have to replace the whole action and I’m not going to recommend that.

Userlevel 1
Badge

Wow, thanks for the response, Deetz! That sure looks like it to me.

Userlevel 1
Badge

Nevermind. I found it. I knew that was going to happen as soon as I clicked send….

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