test

vinnus
Tera Contributor

test

11 REPLIES 11

vinnus
Tera Contributor
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:evaluate var="jvar_keyTheme" expression="RP.getParameterValue('sysparm_KeyTheme')"/>
<g:evaluate var="jvar_RootCause" expression="RP.getParameterValue('sysparm_RootCause')"/>


<p>Please click 'Yes' to acknowledge that the fields below are accurate:-</p>

<p><strong> Key theme: ${jvar_keyTheme} </strong></p>
<p><strong> Root Cause: ${jvar_RootCause}</strong></p>

<!--<p>Select OK to confirm the change</p> <p>Select Cancel to keep the original value.</p>-->

<g:ui_form>
<div class="modal-footer">
<span class="pull-right">

    <!--<button class="btn btn-default" id="cancel_button" onclick="window.GlideModalForm.prototype.locate(this).destroy(); doCancel(); return true" style="min-width: 5em;" title="" type="submit">-->
    <button class="btn btn-default" id="cancel_button" onclick="window.GlideModalForm.prototype.locate(this).destroy();  doRefresh(); return true" style="min-width: 5em;" title="" type="submit">
        No
        </button>
    <button class="btn btn-primary" id="ok_button" onclick="window.GlideModalForm.prototype.locate(this).destroy(); return true" style="min-width: 5em;" title="" type="submit">
        Yes
    </button>
</span>
</div>
    </g:ui_form>


</j:jelly>

vinnus
Tera Contributor
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var item = g_form.getValue('record_producer');
    if ((item == '550e5dcbdb72f05039e27914b99619ad') || (item == 'd4bf527ddb1a281039e27914b9961917') || (item == 'ac8074fedb36b05039e27914b99619f0') || (item == '000becf4dbde641039e27914b99619b6') || (item == '1a652b541b518d10cd7aa716624bcb37') || (item == '9637621cdb52641039e27914b996194a') || (item == '97e761d0db95709039e27914b99619b2') || (item == '2c40cb0ddbe8b85039e27914b99619e6') || (item == '4e9656f4db52a41056b9475f29961975') || (item == '18e2f295dbe4f85039e27914b996197b') || (item == 'dc8c685e47ce19104968754a436d43b2')) {
        if ((newValue == '3') || (newValue == '4')) {
            var dialog = new GlideModal('x_jj_dfit_Confirm Key Theme', true, 800);
            //dialog.setTitle("Alert: Confirm Submit");
            //dialog.setPreference('focusTrap', true);
            //dialog.setPreference('cancel_button', doCancel);
            dialog.setPreference('sysparm_KeyTheme', g_form.getValue('key_theme'));
            dialog.setPreference('sysparm_RootCause', g_form.getValue('root_cause_kt'));

            dialog.render();
        }
    }

    //Type appropriate comment here, and begin script below

}

vinnus
Tera Contributor

// Update the opened_at field of specific cases for testing

 

var caseGR = new GlideRecord('x_jj_dfit_case');

caseGR.addQuery('number', 'CASE0010001'); // Replace with the actual case number or other filter

// You can also use addQuery('sys_id', '...') or broader filters

caseGR.query();

 

while (caseGR.next()) {

    var newDate = new GlideDateTime();

    newDate.subtract(GlideDateTime.DAY, 15); // Set to 15 days ago

    caseGR.opened_at = newDate;

    caseGR.update();

    gs.info('[Test] Updated case ' + caseGR.number + ' opened_at to: ' + newDate.getDispla

yValue());

}

vinnus
Tera Contributor
   //This scheduled job triggers everyday to filter out all the pending approval for 10 days and close them on 14 day Finanicial Case request.

var apprRec= new GlideRecord('sysapproval_approver');
apprRec.addQuery('state','requested');
apprRec.addQuery('sysapproval.sys_class_name','x_jj_dfit_case');
apprRec.addEncodedQuery('^state!=not_required^ORstate=NULL^sys_updated_onRELATIVELT@dayofweek@ago@10');
apprRec.query();
while(apprRec.next()){
    gs.eventQueue('x_jj_dfit.smpaccess.approval.reminder',apprRec, apprRec.approver, apprRec.approver.user_name);
   
}

var apprec1= new GlideRecord('sysapproval_approver');
apprec1.addEncodedQuery('^state!=not_required^ORstate=NULL^sys_updated_onRELATIVELT@dayofweek@ago@14');
apprec1.addQuery('state', 'requested');
apprec1.addQuery('sysapproval.opened_at', '<=', gs.daysAgoStart(14) );
apprec1.addQuery('sysapproval.record_producer', '58d2d15adbc4341056b9475f29961970');

apprec1.query();

 while (apprec1.next()) {
    apprec1.state ='not_required';
    apprec1.comments ='The case has been closed because it was not approved in the defined time. If you still require the requested action, please submit a new case';
    apprec1.update();
 }
   

vinnus
Tera Contributor

var apprec1 = new GlideRecord('sysapproval_approver');

apprec1.addQuery('state', 'requested');

apprec1.addQuery('sysapproval.opened_at', '<=', gs.daysAgoStart(14));

apprec1.addQuery('sysapproval.record_producer', '58d2d15adbc4341056b9475f29961970');

apprec1.query();

 

while (apprec1.next()) {

    apprec1.state = 'not_required';

    apprec1.comments = 'The case has been closed because it was not approved in the defined time. If you still require the requested action, please submit a new case.';

    apprec1.up

date();

}