Skip to main content
Solved

Default Values in Convert to Project Dialog/Popup


Forum|alt.badge.img

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!

 

 

Best answer by darylbowman

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.

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

3 replies

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1716 replies
  • Answer
  • March 3, 2022

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.


Forum|alt.badge.img
  • Author
  • Freshman II
  • 14 replies
  • March 3, 2022

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


Forum|alt.badge.img
  • Author
  • Freshman II
  • 14 replies
  • March 3, 2022

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


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