Skip to main content
Solved

How to make a customized field editable when PO is in Open status


Forum|alt.badge.img+3

Hello all,

I have tried to modify the current workflow as:
 

This Test Workflow is an extension of RO Workflow

But still when the PO is in Open status. the field (Time Only Value) is still disabled.
 


What is it that I am missing here?

Best answer by Nilkanth Dipak

Hi @Harshita , I believe the steps you have followed are correct and and it should enable the field.

 

If from workflow, it is not working, you can add below code snippet to the POOrderEntry extension graph to make it enable.

 

protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
    if (InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
    var row = (POLine)e.Row;

    if (row == null) return;

    var itemExt = row.GetExtension<POLineExt>();
    if (itemExt == null) return;


    POOrder order = PXSelect<POOrder, 
        Where<POOrder.orderType, Equal<Required<POOrder.orderType>>, 
        And<POOrder.orderNbr, Equal<Required<POOrder.orderNbr>>>>>
        .Select(Base, row.OrderType, row.OrderNbr);

    if (order != null && order.Status == POOrderStatus.Open)
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, true);
    }
    else
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, false);
    }
}

Hope, it helps!

 

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

7 replies

Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @Harshita , I believe the steps you have followed are correct and and it should enable the field.

 

If from workflow, it is not working, you can add below code snippet to the POOrderEntry extension graph to make it enable.

 

protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
    if (InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
    var row = (POLine)e.Row;

    if (row == null) return;

    var itemExt = row.GetExtension<POLineExt>();
    if (itemExt == null) return;


    POOrder order = PXSelect<POOrder, 
        Where<POOrder.orderType, Equal<Required<POOrder.orderType>>, 
        And<POOrder.orderNbr, Equal<Required<POOrder.orderNbr>>>>>
        .Select(Base, row.OrderType, row.OrderNbr);

    if (order != null && order.Status == POOrderStatus.Open)
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, true);
    }
    else
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, false);
    }
}

Hope, it helps!

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • July 8, 2024

Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • July 8, 2024
Dipak Nilkanth wrote:

Hi @Harshita , I believe the steps you have followed are correct and and it should enable the field.

 

If from workflow, it is not working, you can add below code snippet to the POOrderEntry extension graph to make it enable.

 

protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
    if (InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
    var row = (POLine)e.Row;

    if (row == null) return;

    var itemExt = row.GetExtension<POLineExt>();
    if (itemExt == null) return;


    POOrder order = PXSelect<POOrder, 
        Where<POOrder.orderType, Equal<Required<POOrder.orderType>>, 
        And<POOrder.orderNbr, Equal<Required<POOrder.orderNbr>>>>>
        .Select(Base, row.OrderType, row.OrderNbr);

    if (order != null && order.Status == POOrderStatus.Open)
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, true);
    }
    else
    {
        PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomField>(cache, row, false);
    }
}

Hope, it helps!

 

Hello @Harshita , shall I use this as graph extension?
 

or this?
 

 


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @Harshita ,

You can use POOrderEntry graph to extend as your first screenshot.


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • July 8, 2024
Dipak Nilkanth wrote:

Hi @Harshita ,

You can use POOrderEntry graph to extend as your first screenshot.

shall I add the code between #region Event handlers?


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • July 8, 2024

Yes @Harshita Since you are non technical it will be difficult for you to write the code. I would highly recommend you to complete the Developer Certification so that you will get the basics about the development tasks.


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Yes, it's a good practice to add the event handler code within the #regionsection to maintain code organization and readability. This helps keep related code together and makes it easier to manage and navigate through the codebase.

 


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