Approval for project task

rambo1
Tera Guru

When approval status is set to 'requested' manually on project task , approval should go to project manager, 

I have written a business rule to generate a approval:

var app = new GlideRecord('sysapproval_approver');
app.initialize();
app.sysapproval = current.sys_id;
app.document_id = current.sys_id;
app.approver = current.parent.project_manager;
app.state = 'requested';
app.insert();

Also tried from workflow, but document id field is not getting populated. Please help me wth this issue.

1 ACCEPTED SOLUTION

Milind Gharte
Kilo Guru

 

Hi ,
Here is a link which will help you.

https://community.servicenow.com/community?id=community_question&sys_id=1f489c48dbb12300afc902d5ca96...

 

If it helps,Please mark Correct and 👍 Helpful.

Warm Regards,

Milind

View solution in original post

6 REPLIES 6

Miguel Donayre
ServiceNow Employee
ServiceNow Employee

can you remove this line app.document_id = current.sys_id. That is calculated based on the disapproval field. 

then how do I populate approval for field?

 

I just took your code took at that piece of code and add it to a business rule and it worked for me 

*you will have to add in the approvers related list to see that tab

 

I would recommend not using this method. I would go with doing this with Flow or workflow. 

this line of code does that 

app.sysapproval = current.sys_id;