Question about getRefRecord :)

joseeduardo
Giga Expert

Captura.PNG

Hello can someone explain me whats wrong here?? why it says it is a null field! It shouldnt! I mean I have lots of incidents with a caller Id!! thank you very much guys!

1 ACCEPTED SOLUTION

jajajaja LOL I just realized something! I got the null because of the "if", as we all of us know "if" will only search forward for the first record LOL here is my problem! Deepak Ingale and Michael Fry are both quite right!! I used the while loop and then I just found this first record a null one, so this was the cheater one that was showing up before!!



Captura.PNG



Now I want to highlight something! maybe it could even be worth of putting it on another discussion!! why are these null boys coming out?? if I just copied the script of servicenow wiki and in the scripting was a notNull! well check this out! there is some kinda of mistake in the wiki!!




Captura.PNG


well this is the mistake!, it is not: notNullQuery() instead should be: addNotNullQuery() , so if you use this last script it will work!




But guys actually there is something weird here! maybe some one with more experience could correct me if there is not such a weird thing! so far for me it is! look at this! if you use in this same code(well the only thing I actually changed was the loop I used a "while" one), if you instead use a simple addQuery() It returns only the NULL records! why?? you may ask to some else! cause I   dont know! the good point here is that in most of the cases it is supposed that a null record here is useless for us! so we can use addNotNullQuery() but any ways I just let you use this with precaution!


View solution in original post

8 REPLIES 8

Hi Jose,


Please check the caller record if that has FirstName and LastName set.


name is dependant of firstname and lastname


if both are blank, name would be blank.


Thanks for helping! check out the ultimate answer I wrote for this case! thank very much!


Michael Fry1
Kilo Patron

I think the if line should be a while. So this:


while (grINC.next()) {


jajajaja LOL I just realized something! I got the null because of the "if", as we all of us know "if" will only search forward for the first record LOL here is my problem! Deepak Ingale and Michael Fry are both quite right!! I used the while loop and then I just found this first record a null one, so this was the cheater one that was showing up before!!



Captura.PNG



Now I want to highlight something! maybe it could even be worth of putting it on another discussion!! why are these null boys coming out?? if I just copied the script of servicenow wiki and in the scripting was a notNull! well check this out! there is some kinda of mistake in the wiki!!




Captura.PNG


well this is the mistake!, it is not: notNullQuery() instead should be: addNotNullQuery() , so if you use this last script it will work!




But guys actually there is something weird here! maybe some one with more experience could correct me if there is not such a weird thing! so far for me it is! look at this! if you use in this same code(well the only thing I actually changed was the loop I used a "while" one), if you instead use a simple addQuery() It returns only the NULL records! why?? you may ask to some else! cause I   dont know! the good point here is that in most of the cases it is supposed that a null record here is useless for us! so we can use addNotNullQuery() but any ways I just let you use this with precaution!