- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2023 06:03 AM
Hi experts,
I have read some other posts about dynamic module within the Application Menu, but none of them help me solve my problem.
1. I have a list of Skill Evaluation Submission. The Submission's fields are as below:
2. I have 3 groups which are: SE User, SE PM, SE CoE
I need to create a module shows a list of Submission record, where:
- Records with state = "Submitted" should be visible to users in SE PM group
- Records with state = "Reviewed" should be visible to users in SE CoE group
I really appreciate your help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 09:03 AM
Hi @quangminh_doan ,
You can achieve it with script:
In script include create a function with code as below:
If current user belongs to SE PM group then var enqr= (state = "Submitted")
Else if current user belongs to SE CoE group then enqr = (state="Reviewed").
Then create a GlideRecord query on submission table.
Use the same encoded query.
Then push the sys_id in an array and return it.
This will allow you to have different set of sysId.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2023 10:14 AM
Hello @quangminh_doan ,
You can achieve it using a before query business rule.
In Advance script check
If current user belongs to SE PM group then var enqr= (state = "Submitted")
Else if current user belongs to SE CoE group then enqr = (state="Reviewed").
*Please create the encoded query from list filter.
Finally use current.addEncodedQuery(enqr);
This will give you dynamic results.
Hope this answers will be helpful.
Please mark the answer as helpful and correct.
Best Regards,
Rajat Choudhary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2023 08:29 PM
I have another before query BR that restricts SE User to view all Submission records (the code is as below):
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (gs.getSession().isInteractive() && gs.hasRole('x_955989_se.se_admin')) {
current.addEncodedQuery('numberISNOTEMPTY');
} else {
var currentUser = gs.getUserID();
current.addQuery('assigned_to', currentUser);
}
})(current, previous);The reason why I create this BR because somehow my ACL on read permission didn't work as I expected.
It seems that if I create a new before query BR as your suggestion, the new one wont' work with the warning message "Invalid query detected, please check logs for details [Unknown field null in table x_955989_se_submission]".
Is there any other way to solve my mentioned problem? (I'm thinking of create a Script Include, then select the link type of Module as Script and call the Script Include, but I don't know how to do this properly)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 09:03 AM
Hi @quangminh_doan ,
You can achieve it with script:
In script include create a function with code as below:
If current user belongs to SE PM group then var enqr= (state = "Submitted")
Else if current user belongs to SE CoE group then enqr = (state="Reviewed").
Then create a GlideRecord query on submission table.
Use the same encoded query.
Then push the sys_id in an array and return it.
This will allow you to have different set of sysId.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 12:25 AM
Hi @Rajat_Choudhary ,
Thanks for your advice on the script include. I have a look at the system logs and the script really returns an array of sys_id. Just another question is how to use this script include in module? I tried this syntax javascript: new myScriptIncludeName().functionName() in argument when crate module but it didn't work as I expected.