Update Historical List Data in a Background Script

Elizabeth26
Tera Contributor

I normally update historical data in background scripts when necessary.

However, this one is not working as I'd like.

 

I have an old field which was a list field. I have multiple random combinations of values.

I want to move the data into a new table and new field which is now a singular choice.

 

I am trying to grab the singles first where I can but I can't get the singles to appear in a query even if I filter to just show "retaliation" I get all the combos that include it as well. Here is the query x_letter_claims!=NULL^x_letter_claims=Retaliation

 

I was hoping to use a background script like I've normally done but if I can't get the query to come up I am not sure what to do? 

 

For example: I am getting retaliation, gender, disability or retaliation, gender or retaliation. I have many variations and combos and I am not sure what to do. I thought I'd first just try updating the ones that are singular but I can't even get that query to work. 

 

var grAll = new GlideRecord('x_table');

 

grAll.addEncodedQuery('x_letter_claims!=NULL^x_letter_claims=Retaliation');

grAll.query();

 

while(grAll.next()) {

grAll.x_claims = 'Retaliation';

grAll.autoSysFields(false);

grAll.setWorkflow(false);

grAll.update();

 

}

1 ACCEPTED SOLUTION

Try adding a condition for does not contain comma:

NiaMcCash_0-1674579020930.png

 

View solution in original post

12 REPLIES 12

Try adding a condition for does not contain comma:

NiaMcCash_0-1674579020930.png

 

Thank you. I think this will work for what I need.

 

Any suggestions for how to get the unique combinations to group together?

I know how to do a background script for this. I do it all the time.

 

The problem is just I can't get the data to show up good in a query so I can have everything match up.

 

How can I get just retaliation to show up and not all the other combinations? That is my issue.