How to avoid appending empty rows in array record type

Certified Associate Developer

Hi Team,

I have a requirement for creating an audit table in that i need compare the existing data and updated data and need to add only changed field values. for this 1st I'm querying the existing data in a local var, then after changing some fields in the UI, I'm performing a save into operation which involves a!foreach which compares the queried data & UI rule input fields so when there is a difference I'm appending one row for that changed field in audit record type rule input(array). but if there is no change I no need empty- row in audit table. but some how my code appending empty rows for fields with no changes. 

Kindly provide suggestion it'll be helpful.

Thanks in advance



here ri!isupdate will check whether it is update action or create action




here I didn't change anything in one field but it gets adding null value

  Discussion posts and replies are publicly visible