Add Approve and Reject button on approval table which are visible on workspace

Prudhvi Raj Y
Tera Expert

Hi,

 

We have workspace where users are able to approve the request from sysapproval_approver table but there are no Approve and Reject button from workspace I have tried to add custom once but button is not getting visible on workspace.

PrudhviRajY_0-1784610772782.png

Please let me know if something is missing.

 

Regards,

Prudhvi

1 ACCEPTED SOLUTION

Vikram Reddy
Tera Guru

Yes, this can be done using Declarative Actions in Configurable Workspace. Try these steps:

  1. Create two Form Declarative Actions on sysapproval_approver: Approve and Reject.

  2. Use this visibility condition:

current.state == 'requested' &&
(gs.hasRole('approval_admin') ||
 new global.ApprovalDelegationUtil().isMyApproval(current))
  1. Approve script:
current.state = 'approved';
current.update();
new global.ApprovalUserFeedback().approved(current);
  1. Reject script:
current.state = 'rejected';
current.update();
new global.ApprovalUserFeedback().rejected(current);
  1. Create corresponding records in:
    • sys_ux_form_action
    • sys_ux_form_action_layout_item
  2. Add both layout items to the Form Action Layout used by your Workspace.

I verified in my instance, this should work

 

Thank you,

Vikram Karety,

Octigo Solutions INC

View solution in original post

9 REPLIES 9

Hi  ,

 

Yes I have tried creating Declearative form action but still button is not visible.

 

Regards,

Prudhvi

Tejas Adhalrao
Kilo Sage

hi @Prudhvi Raj Y  ,

you can check approve or reject action is active or not .

TejasAdhalrao_0-1784615339042.png

 

or can create new one , refer this 

https://youtu.be/Nk7iHn38AD0?si=o8296l_zZf4pC_kJ

 

 

If you found my solution helpful, please mark it as Helpful and Accept Solution.

thanks ,

tejas😊

 

 

 

Tanushree Maiti
Tera Patron

Hi @Prudhvi Raj Y 

 

If you need that customization , you have to use Declarative Actions are the recommended way to create buttons and actions in  ServiceNow Configurable Workspaces.

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Vikram Reddy
Tera Guru

Yes, this can be done using Declarative Actions in Configurable Workspace. Try these steps:

  1. Create two Form Declarative Actions on sysapproval_approver: Approve and Reject.

  2. Use this visibility condition:

current.state == 'requested' &&
(gs.hasRole('approval_admin') ||
 new global.ApprovalDelegationUtil().isMyApproval(current))
  1. Approve script:
current.state = 'approved';
current.update();
new global.ApprovalUserFeedback().approved(current);
  1. Reject script:
current.state = 'rejected';
current.update();
new global.ApprovalUserFeedback().rejected(current);
  1. Create corresponding records in:
    • sys_ux_form_action
    • sys_ux_form_action_layout_item
  2. Add both layout items to the Form Action Layout used by your Workspace.

I verified in my instance, this should work

 

Thank you,

Vikram Karety,

Octigo Solutions INC

Hi @Vikram Reddy 

I followed the same steps but still I'm not able to see the button the form. Do I need to create the UI action as well apart from above steps?

PrudhviRajY_0-1784702987604.png

 

 

Regards,

Prudhvi