Skip to main content
Solved

Make certain fields editable based SO Lines for closed order


Joe Schmucker
Captain II
Forum|alt.badge.img+3

This is almost a duplicate of this post 

https://community.acumatica.com/develop-customizations-288/make-certain-fields-editable-based-on-po-status-15192

I’ve tried the suggestions on that post but it is not resolving my issue.

I am trying to make two fields editable when the SO is CLOSED.  I’ve modified the Workflow as follows:

I added code as well:

namespace PX.Objects.SO
{
  public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
  {
    #region Event Handlers
    protected void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
    {
        baseHandler?.Invoke(cache, e);
        var row = (SOLine)e.Row;

        PXUIFieldAttribute.SetEnabled<FSxSOLine.sDSelected>(cache, row, true);
        PXUIFieldAttribute.SetEnabled<SOLine.requestDate>(cache, row, true);

    }
    #endregion
  }
}

The fields are still not editable.

I am thinking that the update cache option for the SO Lines is disabled for a closed order.  If that is the case, maybe there is no way to enable them.

Any suggestions?

Best answer by Naveen Boga

Hi, @Joe Schmucker  Hope you are doing well!

We can enable the fields even after the Sales Order document is moved to COMPLETED status as well.

I have done minor changes to the code and workflow steps and fields are enabled and able to modify as well.

 

Please find the attached screenshot and customization package for your reference.

 

View original

Naveen Boga
Captain II
Forum|alt.badge.img+19

Hi, @Joe Schmucker  Hope you are doing well!

We can enable the fields even after the Sales Order document is moved to COMPLETED status as well.

I have done minor changes to the code and workflow steps and fields are enabled and able to modify as well.

 

Please find the attached screenshot and customization package for your reference.

 


Joe Schmucker
Captain II
Forum|alt.badge.img+3

@Naveen Boga 

Thank you Naveen.  I thought it might have had to do with the cache being disabled for the grid.  Thanks for showing me how!

These are the lines I was missing:

                    Base.Document.Cache.AllowUpdate = true;
                    Base.Transactions.Cache.AllowUpdate = true;
Also, it is freaky that the project name you created was exactly the same as the one I created!  😀

When I imported your project, I was confused that there were two with the same name!  HAHA!

It works now. 

As always, thank you for your time and gracious assistance.


Naveen Boga
Captain II
Forum|alt.badge.img+19

Hi, @Joe Schmucker  HAHA... It Happens :) !!

Thanks a lot for confirming that the solution is working fine :)

 

 

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+1

Hi @Naveen Boga 

 

We are trying to do something similar with AR Invoice (AR301000) to make the Customer Order Nbr (ARInvoice.InvoiceNbr) editable after releasing the invoice. From what I could find, we need to add a new workflow to the screen customization and add code for cache update. I have no problem adding a new workflow and unchecking Disabled for the field we need, but I am having trouble with adding the cache update code.


Joe Schmucker
Captain II
Forum|alt.badge.img+3

Hi @nathantrauscht ,

In the recent past, I found that the solution I used above created errors on an import process because I’d changed the state of the caches to allow them to be updated.  For some reason, the import process did not like the changes.  I had to undo the changes to the workflow and remove the code from my VS library.

The solution I now use when someone needs to edit a field that is read only is to create a dialogue (smart panel) that has the field to be edited, and I update the field directly on the table in an Action.  It is a lot cleaner.  But be careful when you allow someone to edit a field in case it is a key field or has an impact on some other linked record.

A kind soul named Keith Richardson created a Youtube vid which walks you through the entire process to do this smartpanel.  I’ve used the video.  It is fantastic.

https://www.youtube.com/watch?v=Knp723AFQII&t=164s

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+1

Hi @Joe Schmucker 

I appreciate your quick response and feedback. I am giving this a try now. Occasionally, salespeople make a typo on a customers PO Nbr or the customer did not provide a PO Nbr at time of ordering and we need to correct/update it after the Invoice has been released. Current process is to “Correct” the invoice, but it’s not a clean process and often confuses the customer.

Please take a look at how I have set it up and let me know if this looks correct to you, I have not setup a dialog box before.

Dialog Box
Action for Dialog Box Field Update

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+1

Hi @Joe Schmucker I appreciate you sharing the video - I was under the impression we could add this dialog box and action no code. Are the steps he went through necessary or will the dialog box and action added to the menu like I did above be sufficient to update the database field?


Naveen Boga
Captain II
Forum|alt.badge.img+19
nathantrauscht wrote:

Hi @Naveen Boga 

 

We are trying to do something similar with AR Invoice (AR301000) to make the Customer Order Nbr (ARInvoice.InvoiceNbr) editable after releasing the invoice. From what I could find, we need to add a new workflow to the screen customization and add code for cache update. I have no problem adding a new workflow and unchecking Disabled for the field we need, but I am having trouble with adding the cache update code.

Hi @nathantrauscht  Have you figured it out the solution?


Joe Schmucker
Captain II
Forum|alt.badge.img+3

Sorry @nathantrauscht.  That option shown on the video requires code.  It isn’t much code, but it does require it.  At least I THINK it requires code.  The work you show in your post above looks like you are on to something, but I’ve never done anything with that screen.   I do all the db work via code.  What you show looks like it has promise, but I don’t have the expertise to help there.

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+1

@Naveen Boga @Joe Schmucker 

We tested the dialog box solution. It seemed like it was going to work, but instead of updating it with the text entered into the dialog box it cleared the Customer Order Number (ARInvoice.InvoiceNbr) making it blank. I’m not sure what the problem is because it clearly updated it, but cleared it instead of using the text from the dialog box. Any ideas?

 

I also tried creating an new workflow and changing the field to editable in that workflow. I thought I did it right, but it did not make it editable, I must be missing something. My understanding, is that after 21R1 you no longer needed to add a code to allow cache updates because the workflow edits accomplished that.

I’ve seem a similar workflow change work in the sales order entry screen by do the same thing, but it’s laid out a little differently.

Any ideas?

I might just watch the video again and try that route, though I thought the point of the recent updates was to make no code changes to workflow simpler. But, maybe I am missing some context.

 


Joe Schmucker
Captain II
Forum|alt.badge.img+3

Hi @nathantrauscht 

When I created the smartpanel, I followed the video line for line.  

Here’s a copy of my code I used to change the value in a Usr field on my DAC extension.  The same logic applies, you just won’t need to get a reference to a DAC extension.

		public PXFilter<ICSChangeReorderDate> ChangeReorderDateView;

		public PXAction<SOLine> ChangeReorderDate;
		[PXUIField(DisplayName = "Change Reorder Date", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
		[PXButton(Category = "Corrections", CommitChanges = true)]
		protected virtual IEnumerable changeReorderDate(PXAdapter adapter)
		{
			if (ChangeReorderDateView.AskExt() == WebDialogResult.OK)
			{
				SOLine soLine = Base.Transactions.Current;
				if (soLine == null) return adapter.Get();

				NotableSOLineExt ext = soLine.GetExtension<NotableSOLineExt>();
				if (ext == null) return adapter.Get();

				var Filter = ChangeReorderDateView.Current;
				if (Filter == null) return adapter.Get();

				ext.UsrReorderDate = Filter.UsrReorderDate;

				Base.Transactions.Update(soLine);
				Base.Save.Press();
			}
			return adapter.Get();
		}

I can’t help you with a workflow.  I have never had success using them.  

Hope this helps.


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+1

@Joe Schmucker I found this page Changing an Acumatica PO Number with Smart Panel and Custom Action which had links to the code from that video.

That made it a lot easier for me to try to implement this project. I inserted the graph extension and smart panel code and it’s working great!

Thank you for your support!


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