How to add a field of 'Approval' on a form to allow user to manually add approvers?

FH
Tera Contributor

I would like to have a grid sort of thing to be displayed in a form, and it will show approvals generated automatically by workflow, and also allow user to manually add additional approvers.

DO I need first create a relationship, and add a column ( which type) to the table, and then add the field to the form?

Could someone shed some light on this?

Many thanks

Frances

4 REPLIES 4

harshinielath
Tera Expert

When you have a approval activity in the workflow and give the approvers,it lists on the form in the related lists(approvers section) by default.So to let the user add additional approvers,you need an UI action.Maybe in that you can access the table and add the approvers to it. It should be a reference type to sys_user table as approvers are employees.


FH
Tera Contributor

Thank you very much for replying.



I think I have three things not quite right yet.



First I created the relationship to 'sysapproval_approver' with the following script:


      var gr = new GlideRecord('sysapproval_approver');


      gr.addQuery('sysapproval',current.number);


But I see all rows from 'sysapproval_approver' table, rather than only the rows matching the current Document number.



My second question is how I can then move the related links to a section on the form. At the moment it is at the bottom of the form.



Lastly, I don't know how to add UI action to allow user to add approvers.



Thanks again


Frances


Hi


See that if the current.number is giving the RequestedItem number(like RITM) and as the sysapproval is a reference field to task,I guess it should be as 'sysapproval.number' in addquery() statement.   //Add log statements and see what it is returning exactly



And when you create a UI Action,there will be options in the form that has to be checked for displaying the UI Action on the form like Form Button,List Link. So you can choose where you need it.



You need to write a script in UI Action something like


var g=new GlideRecord('sysapproval_approver');


g.addQuery('sysapproval.number',current.number);     //not sure of this,please use log statements and check what it is returning


g.approver=' sys_id of approver';   //as approver column is reference to sys_user table


g.update();



Let me know if you have any questions.


FH
Tera Contributor

Thank you Harshinielath.   That works ( 'sysapproval.number') !


Now I only see the two approvals for that particular ticket.



How can I move the approvals' list into the 'Business Approval' section, instead of at the end of the form?



Thanks a lot


Frances


find_real_file.png