Updating the Case on no response from requester

kartikey
Tera Contributor

Hi Everyone,

We have a use case that when a HR case goes to suspend state and the opened for person does not provide additional comments for 2 days, it should update the Case record.
Can anyone help me how to achieve the same?


Regards,
kartikey

3 REPLIES 3

Maddysunil
Kilo Sage

@kartikey 

I think you can follow below steps

  • Create a new Business Rule that triggers on the update of the HR case record.
  • Set the condition to check if the case is in the "Suspend" state and if the "Additional Comments" field is empty.
  • If the condition is met, set the action to schedule a job to run after 2 days.

 

if (current.state == 'suspend' && !current.additional_comments) {
    gs.eventQueueScheduled('update_case_job', current, '2d');
}

 

Schedule Job:

  • Schedule a job to run after 2 days using the "Scheduled Jobs" module

 

var gr = new GlideRecord('case_table');
gr.addQuery('state', 'suspend');
gr.addNullQuery('additional_comments');
gr.query();
while (gr.next()) {
    // Update the case record
   
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

 

Hi, addition comments is a journal field right?

var gr = new GlideRecord('case_table');
gr.addQuery('state', 'suspend');
gr.addNullQuery('additional_comments');

moreover if anyone comments apart from opened for, then this would not work right?

@kartikey 

yes, if the condition is checking for additional_comments to be null, it will only work if the additional_comments field is empty. If any comments are added to the journal field by anyone other than the 'opened for' person, it would not meet the condition of being null anymore, and the script logic would not include such records.

If you want to include records even if comments are added by someone other than the 'opened for' person, you might need a different approach

 

var gr = new GlideRecord('case_table');
gr.addQuery('state', 'suspend');
gr.addNullQuery('additional_comments');

// Add condition to check if comments are added by the 'opened for' person
gr.addQuery('opened_for', gs.getUserID()); // Assuming 'opened_for' is a reference field to user table
gr.addOrCondition('opened_for', ''); // Include cases where 'opened_for' is empty (assuming it's not mandatory)

gr.query();
while (gr.next()) {
    // Update the case record
  
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks