Skip to main content
Answer

How to dynamically change connotation of action button?

  • March 14, 2022
  • 3 replies
  • 494 views

brothe58
Jr Varsity II
Forum|alt.badge.img

I would like to dynamically change the color (“Connotation”) of the Confirm Shipment action button (Shipment Entry screen) depending on a condition in 21R2.

Example use case: If the Package Weight is not within an allowable range of the Shipped Weight, then change the Confirm Shipment action button connotation to "Warning". Otherwise, use “Success”. This color change would provide another visual indicator to my fulfillment staff that a shipment is okay to confirm.

I’m currently using the `SOShipment_PackageWeight_FieldUpdated()` event to raise a SetPropertyException, but the warning icon is so small that it’s easily missed. I want to provide more visible feedback to the end-user to help prevent costly packaging errors.

In the 21R2 workflow editor, the color appears to be controlled by the “Connotation” selection.

It does not appear to be possible to conditionally change the connotation of the Action button using the 21R2 workflow editor. How can it be done using code? Maybe using PXScreenConfiguration? I’m unable to find any examples of this online.

Best answer by Naveen Boga

Hi @brothe58  You can write a logic in the ROWSelected Event like below and verify.

 

  protected virtual void _(Events.RowSelected<DACNAME> eventArgs)
{
if (eventArgs.Row == null)
return;

if (somecondition)
{
createAndAuthorizePayment.SetConnotation(Data.WorkflowAPI.ActionConnotation.Danger);

}
else
{
createAndAuthorizePayment.SetConnotation(Data.WorkflowAPI.ActionConnotation.Success);

}
}

 

Hope this helps!!

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • March 14, 2022

Hi @brothe58  You can write a logic in the ROWSelected Event like below and verify.

 

  protected virtual void _(Events.RowSelected<DACNAME> eventArgs)
{
if (eventArgs.Row == null)
return;

if (somecondition)
{
createAndAuthorizePayment.SetConnotation(Data.WorkflowAPI.ActionConnotation.Danger);

}
else
{
createAndAuthorizePayment.SetConnotation(Data.WorkflowAPI.ActionConnotation.Success);

}
}

 

Hope this helps!!


brothe58
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • March 14, 2022

Thanks! Note the Workflow/Customization Project Editor value seems to override whatever value is set via SetConnotation() in code. I had to first remove the Connotation value from the Workflow Editor.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • March 15, 2022

Hi, @brothe58  Hope you have removed connotation from the WorkFlow engine by extending it, and you can able to set the connection through code successfully!!.