Missing Information on SCTask Record, can I remediate?

Hola Ola
Giga Guru

Hello all,

I recently updated a Catalog form, by replacing a field with a Variable Set Reference field.

Unfortunately, I did not update the Flow before moving into PRD (sigh!)

 

Now, the RITM have the field, but the Task does not.

Although I have corrected the issue, but I have about 33 Tasks that are missing that field. 

 

How can I remediate them?

 

Thank you.

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @Hola Ola ,

 

These are set during run time and don't think to dig in here to update,

 

Why don't you put a worknote for these 33 Tasks with updated Variable values using fix script???

 

HemanthM1_0-1729010320758.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

4 REPLIES 4

sundaram080713
Tera Expert

Hello @Hola Ola ,

To resolve the issue with the 33 SCTasks that are missing a field due to the replacement with a Variable Set Reference, you can follow these approaches:

1. Write a Script to Update the SCTasks

  • Use a Background Script to update the missing field in the SCTasks. Since the related RITM records contain the correct data, you can retrieve the values from the RITMs and apply them to the corresponding SCTask records.

Here's an example of how the script could look:

 

var scTask = new GlideRecord('sc_task');
scTask.addEncodedQuery('state!=3^field_name=NULL'); // Adjust query for the relevant tasks
scTask.query();

while(scTask.next()) {
    var ritm = new GlideRecord('sc_req_item');
    ritm.get(scTask.request_item); // Assuming 'request_item' links SCTask to RITM
    
    if (ritm) {
        scTask.field_name = ritm.field_name; // Copy field value from RITM
        scTask.update();
    }
}

 

 

  • Replace field_name with the actual field or variable name.
  • Adjust the query and conditions as needed to target the appropriate tasks.

    2. Manual Updates (If Applicable)

    • For a manageable number of records, you could update the missing field values manually via the UI, especially if there are not many tasks to modify.

    3. Using an Import Set

    • Export the affected SCTask records using Data Export.
    • Update the missing fields in the exported file, using the RITMs as a reference.
    • Reimport the corrected file via an Import Set to update the SCTask records.

    4. Review the Flow Configuration

    • Ensure that the flow (or workflow) is correctly referencing the Variable Set so that future tasks are created with the correct field values.

    By applying one or more of these steps, you should be able to update the missing field values in the SCTasks.


    I’m not an expert, but I did my best to share all the knowledge I have to assist you. If you found my response helpful, I would appreciate it if you could mark it as helpful or like it 🙂




 

ChatGPT didn't understand the question.

Hemanth M1
Giga Sage
Giga Sage

Hi @Hola Ola ,

 

These are set during run time and don't think to dig in here to update,

 

Why don't you put a worknote for these 33 Tasks with updated Variable values using fix script???

 

HemanthM1_0-1729010320758.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Uncle Rob
Kilo Patron

Agree with @Hemanth M1 - "what variables are displaying for this RITM's sc_tasks is buried deep in *I THINK* flow context information.  I doubt you could modify it at that level, and even if you could its so risky I wouldn't do it for 33 tickets. 

Better to write a script and dump to worknotes.