Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

In Incident task table for parent record it should visible affected user how to proceed with this?

ShireeshaVemula
Tera Contributor
 
6 REPLIES 6

Hi @ShireeshaVemula ,

Hope you're doing well!

 

If your requirement is:

When a user opens the incident tasks table, he/she should be able to see the incident task related to the incidents where he/she is the affected user or opened by user.

 

Please use the below code in a Before Query Business Rule(on incident_task) and let me know the result:

(function executeRule(current, previous) {

    if (gs.hasRole('admin')) { // Allow admins to see everything
        return;
    }

    var userId = gs.getUserID();

    current.addEncodedQuery(
        'incident.opened_by=' + userId +
        '^ORincident.caller_id=' + userId
    );

})();


Best Regards,

Sharif Shaik

H there @ShireeshaVemula 

 

You can write an read ACL ON inc task table with script

(function () {

    var userId = gs.getUserID();

    if (!current.incident) {
        return false;
    }

    if (current.incident.opened_by == userId ||
        current.incident.caller_id == userId) {
        return true;
    }

    return false;

})();

 

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.

Kind Regards,
Azar
Serivenow Rising Star
Developer @ KPMG.