generate approval from scheduled job

samadam
Kilo Sage

I have to add approvals from 2 users at 30 days from a job. I one of them approves the approval should be marked approved and other is not required. Is the possible ?

3 REPLIES 3

Bhuvan
Tera Sage

@samadam 

 

Yes, it is possible and  is one of the core functionalities of the platform. You can define approvals using Flow or Workflow and recommendation is to use Flow Designer. Refer below on how to create approvals,

 

https://developer.servicenow.com/dev.do#!/learn/courses/zurich/app_store_learnv2_flowdesigner_zurich...

 

Thanks,

Bhuvan

Ankur Bawiskar
Tera Patron
Tera Patron

@samadam 

you can insert approval record for those 2 users.

But you can't control if any 1 record is approved, this is challenging.

You will require business rule to determine if approval is already approved for the record such as RITM etc then mark the other one as No longer required.

where are you stuck?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

samadam
Kilo Sage

I ended up changing this to group approval. There are two users in this group and when one approves it should mark other not required. Isn't this SN core functionality? this is not happening. Is there anything wrong with this code?

 

Here is my code:

  var approval_gr = new GlideRecord('sysapproval_group');
            approval_gr.initialize();
            approval_gr.approval = 'requested';
            approval_gr.state = 'requested';
            approval_gr.parent = checkCase.sys_id; 
            approval_gr.assignment_group = '2e21c3691b5faa101228a93be54bcb6b'
            approval_gr.source_table = 'sn_hr_core_case';
            approval_gr.short_description = 'Test';
            approval_gr.description = 'Test.';
            approval_gr.insert();