Schedule job

kiran kumar m1
Tera Contributor

After 48 hours of Background Verification – Completed, the Student status should be changed to
‘Registered’ and Enrollment Number should be automatically generated with prefix
‘ENRC00xxxxx’ (Example: ENRC001001, ENRC001002) This should be automatically incremented 

 

How can we do this using schedule jobs?

3 REPLIES 3

Sunny3008
Tera Guru

Hello @kiran kumar m1 ,

 

Can you please elaborate requirements more like is there any table form where we come to know whether verification is completed and which table we have to generate numbers so we can propose a solution according use case?

kiran kumar m1
Tera Contributor

There is student table in that there is status field.

The status field is in Background Verification Pending.

 If status is in that state(BVP) then after 48hours we have to schedule it generate a new Enrollment number in the Enrollment number field(it is in student table)

Hello @kiran kumar m1 ,

 

 You can achieve this requirement using Flow Designer. follow the following steps to achieve this.

 

1. Create a flow designer on the Student table with a trigger condition status is BVP.

Sunny3008_0-1693677970118.png

2. Add flow logic of wait for condition for 48 hour with 24*7 schedule.

Sunny3008_1-1693678038227.png

3. Add action update record. Select the field enrollment number and add a script in it to auto-increment number as follows.

Sunny3008_2-1693678129436.png

Sunny3008_3-1693678217761.png

Script:

var gr=new GlideRecord('student_student');
gr.addEncodedQuery('enrollment_numberISNOTEMPTY')
gr.or
gr.query();
if(gr.next()){
var temp=gr.enrollment_number.toString();
var numericPart = parseInt(temp.match(/\d+/)[0], 10);
numericPart += 1;
var incrementedString = "ENRC" + ("0000000" + numericPart).slice(-7);
return incrementedString;
}else
    return 'ENRC001001'

 

Please mark this as the correct answer and helpful if it is resolved, or mark this helpful if this helps you to reach towards solution.