how to change value of reference field from some value to blank.

d_kush
Giga Contributor

Hi ,

I am trying to populate a reference field from transform map using field map script. I need to clear out this reference field value sometimes, through field script. so i have given value ='NULL' in the else condition of script.. but it is creating below problems

1. first of all it was not clearing the field value at all.

2. when i have created a null value in the referenced table, then it is clearing field value but it is not making it null, means in the filter it is showing it has empty value, but i want to make this value as blank.

here is my questing is it possible to make reference field value as blank? or

To change reference field value to blank always we need to create an empty field in referenced table?

Thanks

13 REPLIES 13

Hi Deepak,



This update is working from background script and fix script but it's not working in transform map field map script..


Deactivating "Run business rule" in transform map is not working.



scenario is that I have created below script to update user name in managed by field of business service table. once name has been populated ,if condition doesn't match ,then that value from managed by field should be removed when next time integration runs.


find_real_file.png



I have tried this script , even i tried target.field ='' ; too , but that too isn't working.



but when i tried below script with creating an empty user in user table , field is clearing it's value. but field value is not null, field is having an empty value.



find_real_file.png


value of that field is displaying like below screen shot:


find_real_file.png



if it null value then it should not have any sys id.


but managed by is referencing to empty value in user table.


Can you confirm that line of code is even being executed?



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Deepak Kumar5
Kilo Sage

You can remove the Field from Mapping and use the Script instead.


If match your condition then update the record else leave it.Remove your else condition.


I need else condition because if else condition matches then only i need to clear the field value...