When Callers Create More Than One Record in a Day

If caller is trying to create more than 1 records in same day then compiler stop creating new incident Record.

If we need to achieve this, we will write a business rule on incident table.

Field NameName
NameRestrict Caller
TableIncident
WhenBefore
InsertYes
if(current.caller_id)
    {
    var inc = new GlideRecord('incident');
    inc.addQuery('caller_id',current.caller_id);
    inc.addQuery('sys_created_on','>=',gs.beginningOfToday());
    inc.addQuery('sys_created_on','<=',gs.endOfToday());
    inc.query();
    if(inc.next())
    {
        gs.addErrorMessage("The caller has already created new incident today");
        current.setAbortAction(true);
    }
    }

Use the above code in advanced script area, then save the business rule and check the incident record creation with same caller names in two record creation. While creating second record creation compiler not to create record.

Leave a Comment

Your email address will not be published. Required fields are marked *

0

Subtotal