Skip to main content

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 “aPXUnboundDefault(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!

 

 

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

public PXAction<PMQuote> convertToProject;
rPXUIField(DisplayName = "Convert to Project", MapEnableRights = PXCacheRights.Select)]
rPXButton(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.


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


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


Reply