Need Help of Request Approval UI Action

NiKhil70
Kilo Guru

Hi All ,

In Related Lists, i have a field called "Approvers".

In the project change Request form , i need to create a button "Request Approval" .

When any user clicks on "Request Approval"  button , then it should go for the Approval .

Ex: If i select Assignment Group as "IT" then Approval should go for all the users who are part of "IT" Group.

I need to see all the user Names  under -> Approvers ( Related Lists ) .

How can i achieve this ?

Can you please help me with the code .

Thanks

NR.

 

1 ACCEPTED SOLUTION

Mandeep Karan
Tera Guru

Create a ui action.

var group = new GlideRecord('sysapproval_group');
group.initialize();
group.assignment_group = current.assignment_group;
group.approval = 'requested';
group.parent = current.sys_id;
group.insert();
action.setRedirectURL(current);

 

find_real_file.png

 

You can put condition based on requirement.

 

Regards,

Mandeep

View solution in original post

4 REPLIES 4

Mandeep Karan
Tera Guru

How you are going to select assignment group for approval? 

if you have any pop up ui page for selecting group, then you must create a script to insert group approval record and set state to requested. it will automatically load the list of approvers in the related list based on group membership.

Generally approvals are generated through workflow.

 

Regards,

Mandeep

Hi Karan ,

I agree that approvals are generated through workflow.

Here client is saying not to user workflow.

Requirement is :

When user selects the Assignment Group "IT" or "Cab" ... Etc and clicks on "Request Approval" button , then under related lists -> Approvers ( They should see all the users who are part of the Group ) .

Then they will open the record and Approve .

How should i populate the users under "Approvers" .

Thanks

NR

Mandeep Karan
Tera Guru

Create a ui action.

var group = new GlideRecord('sysapproval_group');
group.initialize();
group.assignment_group = current.assignment_group;
group.approval = 'requested';
group.parent = current.sys_id;
group.insert();
action.setRedirectURL(current);

 

find_real_file.png

 

You can put condition based on requirement.

 

Regards,

Mandeep

Hi Karan ,

Thanks for the script , i have used your script and made some changes , its working now.

Thanks

NR.