Background Agent, Multivalue Field

Hi, I am trying to get a back ground agent working. The Agent will test a multivalue field, IENRegion, for a value, A/C Managed - HW, and if the value exists, it will update a linked document. The agent works fine from the action menu, but when run in the back ground, it fails at Forall a In item.values, see script below. I know I am not a million miles away, and any help would be appreciated.

Do Until doc Is Nothing

	Set item=doc.getfirstitem("IENRegion")

	contains_flag$="No"

	'If item.Contains( "A/C Managed - HW") Then

	Forall a In item.values

		If a="A/C Managed - HW" Then

			contains_flag$="Yes"			

			Exit Forall

		End If

	End Forall	

	If contains_flag$ = "Yes" Then

		Set org_doc=org_view.GetDocumentByKey(key,True)			

		org_doc.CanvassedHW = contains_flag$

		org_doc.Save True,False

	Else

		contine = True

	End If

	

	Set doc = dc.GetNextDocument(doc)

	

Loop

Subject: Background Agent, Multivalue Field

Since I can’t see all the code, I am guessing it is hitting a document that doesn’t have an item named IENRegion (I am also assuming the error is an Object Variable Not Set). The code needs to handle that situation.

Regards,

Don