Skip to main content
Question

Add Print button in service order screen

  • January 11, 2023
  • 4 replies
  • 200 views

Forum|alt.badge.img

Hi Everyone,

I have a request here to add the print button,

scenario - If i have the below appointment list then print button should be enabled. If not then print button should be disabled.

 

I want to insert the print button here,

 

 

kindly pour your inputs and suggestions here.

4 replies

Forum|alt.badge.img+1

Hi @sujithra,

Please create an Action button which is required, and follow the below steps which are mentioned in the below screenshot.

Go to your customization project and select expand the required screen.

 

 

For Visible/disabled functionality, you can use the RowSelected Event handler.

 

I hope this may help you!

Moulali Shaik.

 

 

 

 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • January 11, 2023

Hi @sujithra  As mentioned by MoulaliShaik, you can add the below logic in the RowSelected event to Visible/Invisible the report button. 

 

 

protected virtual void DACName_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
DACName row = e.Row as DACName;
if (row != null)
{
if(Base.View.Select().FirstTableItems.ToList().Count > 0)
{
ReportButton.SetEnabled(true);
}
else
{
ReportButton.SetEnabled(false);
}
}
}

 


Forum|alt.badge.img
  • Author
  • Freshman II
  • January 12, 2023

Thanks for you response @MoulaliShaik79 . I have added the button however events are not showing after clicking on the required button. 

FYI : Print Appointment Test is the newly added button.

 

 


Forum|alt.badge.img+1

Hi @sujithra,

There you can not find any event handlers.

Please create a Graph Extension class and add the RowSelected Event Handler where you need to write disable/enable button logic. Please take the above code which is provided by @Naveen Boga Naveen as a reference.

 

FYI:

You can create the same DataView (with Different NewDataViewName) by copying and pasting the existing code from the Base Graph into your Graph Extension class.

      



​​​​

 

Check the count value below:

inside the RowSelected Handler.

if (NewDataViewName.Select().count > 0)

{

    // Button enable logic

}

else

{

   // Button disable logic

}

 

 

 

Hope it helps you!

Moulali Shaik.