how to edit already submitted survey cores rating 3 to 4

Aparna
Tera Contributor
 
1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Aparna,

 

As @Dr Atul G- LNG advises, proceed with caution. However, assuming this process has been considered and it is possible that a score legitimately needs to be updated, use the following script in either a Background script or Fix Script for re-use if required.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

try {
    var surveyGR = new GlideRecord("asmt_assessment_instance_question");
    if (surveyGR.get("012a2c44d7211100158ba6859e6103b9")) { // This is the sys_of of the question to update on the submitted survey //Check this by reviewing the questions and make sure you have the correct one.
        gs.print('Survey Instance, question and value: ' + surveyGR.instance.getDisplayValue() + ' - ' + surveyGR.metric.getDisplayValue() + ' :' + surveyGR.value);
        surveyGR.value = 3; //modifying value field
        surveyGR.setWorkflow(false); //Prevent trigger Business rules, workflows etc
        //Once you are happy you have the correct question - uncomment the below update() line
        //surveyGR.update(); 
    }
} catch (e) {
    gs.info('Error thrown in Background Script / Fix Script: Name to be entered here if Fix Script' + e);
}

 

View solution in original post

7 REPLIES 7

Did you check the ACL related to same? Might be need to add Admin override. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Robbie
Kilo Patron
Kilo Patron

Hi @Aparna,

 

As @Dr Atul G- LNG advises, proceed with caution. However, assuming this process has been considered and it is possible that a score legitimately needs to be updated, use the following script in either a Background script or Fix Script for re-use if required.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

try {
    var surveyGR = new GlideRecord("asmt_assessment_instance_question");
    if (surveyGR.get("012a2c44d7211100158ba6859e6103b9")) { // This is the sys_of of the question to update on the submitted survey //Check this by reviewing the questions and make sure you have the correct one.
        gs.print('Survey Instance, question and value: ' + surveyGR.instance.getDisplayValue() + ' - ' + surveyGR.metric.getDisplayValue() + ' :' + surveyGR.value);
        surveyGR.value = 3; //modifying value field
        surveyGR.setWorkflow(false); //Prevent trigger Business rules, workflows etc
        //Once you are happy you have the correct question - uncomment the below update() line
        //surveyGR.update(); 
    }
} catch (e) {
    gs.info('Error thrown in Background Script / Fix Script: Name to be entered here if Fix Script' + e);
}

 

Aparna
Tera Contributor

Hi Robbie,

Thank you, the above code, working fine but i need more help on this. How to edit multiple Questions values in One Survey by using the above fix script. can you please help me on this.