- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 02:06 PM
Once we define a survey as "Anonymize response", we want to hide survey user' name on whatever records related to their response, such as "survey instance" table. However, survey user's name is still shown in the fields of "sys_updated_by" and "sys_created_by" on the response records. These two user fields are controlled by platform mechanism and they will be updated automatically by current logged in user.
The solution we have been trying is to use "impersonate" functionality. We tried to impersonate as 'Guest' user when taking anonymize survey. However, it's not going to work either because "impersonate" is not allowed for all login users. For example, 'Abel Tuter' cannot impersonate as 'Guest' user.
Do we have any anonymous mode to solve this issue? Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Multiple Versions
-
Survey Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 04:12 PM
Hi xinyao,
Use this script for after business rule on 'asmt_assessment_instance_question'
set conditions on when to run
var a = current.instance.sys_updated_by;
var b = current.instance.sys_created_by;
if(a || b){
var gr = new GlideRecord('asmt_assessment_instance');
gr.get(current.instance);
gr.autoSysFields(false);
gr.sys_updated_by = '';
gr.sys_created_by= '';
gr.update();
}
current.autoSysFields(false);
current.sys_updated_by = '';
current.sys_created_by= '';
current.update();
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 02:41 PM
Yes, create a before insert business rule with condition "Anonymize response"
and use this code
current.sys_updated_by = '';
current.sys_created_by = '';
This will do the work
Mark helpful if this helped
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 06:28 PM
Hi Vikram,
I tried your suggestion but I am surprised that it's not working as expected. The "sys_created_by" and "sys_updated_by" are still shown user's name. Here is my code example in our before insert/update business rule:
// When the survey was set up as "Anonymize response", we need to hide survey user's name
var isAnonymized = new AssessmentUtils().isAnonymized(current.getValue("metric_type"));
if (isAnonymized) {
current.sys_created_by = '';
current.sys_updated_by = '';
}
When I printed out above variables and it showed empty which is good. However, it still showed user'name at the end.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 10:08 AM
Hi xinyao,
On what table you have created that business rule? If it is on survey instance there is no metric_type field on that table
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 04:12 PM
Hi xinyao,
Use this script for after business rule on 'asmt_assessment_instance_question'
set conditions on when to run
var a = current.instance.sys_updated_by;
var b = current.instance.sys_created_by;
if(a || b){
var gr = new GlideRecord('asmt_assessment_instance');
gr.get(current.instance);
gr.autoSysFields(false);
gr.sys_updated_by = '';
gr.sys_created_by= '';
gr.update();
}
current.autoSysFields(false);
current.sys_updated_by = '';
current.sys_created_by= '';
current.update();
Thank you,
Vikram