# How can I modify the custom function and include particular fields?

**URL:** <https://the.fmsoup.org/t/how-can-i-modify-the-custom-function-and-include-particular-fields/3761>\
**Category:** Floating Topics\
**Tags:** community, custom-function\
**Created:** [October 27, 2023, 2:44pm UTC](https://the.fmsoup.org/t/how-can-i-modify-the-custom-function-and-include-particular-fields/3761 "2023-10-27T14:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://the.fmsoup.org/u/Saeed)\
**Post date:** [October 27, 2023, 2:44pm UTC](https://the.fmsoup.org/t/how-can-i-modify-the-custom-function-and-include-particular-fields/3761/1 "2023-10-27T14:44:24Z")

</div>

Hi all,

I'm curious if it's possible to customize the following function by incorporating specific fields, such as (First\_name, Lastname, Nationality, etc).

/\* Added exclusions parameter to avoid script \*/

Let ( [  
~thisField = GetValue ( fieldList ; 1 ) ;  
~thisFieldType = FieldType ( Get ( FileName ) ; ~thisField ) ;

```
~changelog = changelog & ¶ ;

// Parse previous value for this field from the existing Change Log text
// This next step uses special "arrowhead" characters, not less than and greater than, to reduce the likelihood of finding a match within field contents
~prevValueStart = Position ( ~changelog ; "˂" & ~thisField & "˃" ; 1 ; 1 ) ;
~prevValueStart = Case ( ~prevValueStart > 0 ; Position ( ~changelog ; "\" to \"" ; ~prevValueStart ; 1 ) + 6 ) ;
~prevValue = Case ( ~prevValueStart > 0 ; Middle ( ~changelog ; ~prevValueStart ; Position ( ~changelog ; ¶ ; ~prevValueStart ; 1 ) - ~prevValueStart - 1 ) )

```

] ;  
Case ( not IsEmpty ( ~thisField ) ;

```
	List (	// Record a change for this field value if it's not a calculation field, and it's not in our ignored list

                                      
		Case ( IsEmpty ( FilterValues ( ~thisField ; exclusions ) ) and Right ( LeftWords ( ~thisFieldType ; 1 ) ; 4 ) ≠ "Calc" ;
			Get ( CurrentHostTimestamp ) & ": " & Get ( AccountName ) & " changed ˂" & ~thisField & "˃" & // Wrapping with "arrowhead" characters
			Case ( MiddleWords ( ~thisFieldType ; 2 ; 1 ) ≠ "Container" ; " from " & Quote ( ~prevValue ) & " to " & Quote ( GetField ( ~thisField ) ) )
		) ;

		Excelisys_ChangeLog ( MiddleValues ( fieldList ; 2 ; ValueCount ( fieldList ) ) ; changelog; exclusions ) // Call the custom function again for all remaining fields in the list

                                          & ("-------------------------------------------")

	)
)

```

)

---

<div class="post-metadata">

**Author:** ![daleallyn](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/daleallyn/32/819_2.png) [@daleallyn](https://the.fmsoup.org/u/daleallyn)\
**Post date:** [October 30, 2023, 7:11am UTC](https://the.fmsoup.org/t/how-can-i-modify-the-custom-function-and-include-particular-fields/3761/2 "2023-10-30T07:11:17Z")

</div>

Hi, @Saeed , as mentioned in another FM community 😉 you'll want to _Exclude_ certain fields, rather than include the ones you want audited. For example the modification time stamp, the changeLog field itself, etc. would normally be added to the global variable ($$) in the startup script to avoid including them. No modification to the custom function(s) will be required.

Also, exact details will depend on whether you're using the older, original version of the audit log, or the newer "Revised" one. The older version has one custom function, the newer one has four.

I provided rather verbose replies as I attempted to learn what you were experiencing. Happy to add clarification or details here if you prefer.

---

<div class="post-metadata">

**Author:** ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://the.fmsoup.org/u/Saeed)\
**Post date:** [October 31, 2023, 6:43pm UTC](https://the.fmsoup.org/t/how-can-i-modify-the-custom-function-and-include-particular-fields/3761/3 "2023-10-31T18:43:50Z")

</div>

I appreciated your assist me …
