How to insert a new variable with value based on conditions in existing records using FIX script.

Saujanyae
Tera Contributor

I have a requirement to create a select box variable which will be hidden on intake Form and Portal, that variable holds two values "Complex" and "Simple", this variable auto populate with the values based on other existing variable values i.e.,

var A is not empty,

var B is not empty,

Var C is YES and Var D is YES  if these conditions met then we are setting the created variable value as "complex" otherwise "Simple".

Now, the issue is this is  working for newly created records but not to the old records.

I need to update the existing records with the newly created variable and also need to get the value for those records based on above conditions.

 

Please advise as to what do I need to do in order to get the desired functionality here.

 

Thanks,

Saujanyae

 

 

1 ACCEPTED SOLUTION

Sanjay191
Tera Sage

Hello @Saujanyae 

Please  refer the below logic and use it according to your usecase and if any consern then please reply back from this thread .
var grRecord = new GlideRecord("targetTable")

grRecord.query();

while(grRecord.next()){

  if(variable A !="" && variable B !="" && variable C =="Yes" && variable =="Yes"){

        grRecord.variable ="complex";

}

else{

     grRecord.variable = "Simple";

}

grRecord.update();

}

 

Above script only for the existing records or Old records that has been in system 

and also i just wanted to confime one things that you are using the record producer for this  or for the catalog item ?



If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You

View solution in original post

1 REPLY 1

Sanjay191
Tera Sage

Hello @Saujanyae 

Please  refer the below logic and use it according to your usecase and if any consern then please reply back from this thread .
var grRecord = new GlideRecord("targetTable")

grRecord.query();

while(grRecord.next()){

  if(variable A !="" && variable B !="" && variable C =="Yes" && variable =="Yes"){

        grRecord.variable ="complex";

}

else{

     grRecord.variable = "Simple";

}

grRecord.update();

}

 

Above script only for the existing records or Old records that has been in system 

and also i just wanted to confime one things that you are using the record producer for this  or for the catalog item ?



If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You