Elliott or Alnoor might have a better response but what i found is if the script is running from Item Maintenance then it will not create or update the record in CI_ExtendedDescription. The only way i could get it work within Item Maintenance was with the following. This must be on the Pre-Write event.
```
sExtendedDescriptionKey = """" : oBusObj.GetValue ""ExtendedDescriptionKey$"", sExtendedDescriptionKey
If sExtendedDescriptionKey = """" Or sExtendedDescriptionKey = ""0000000000"" Then
sItemCodeDesc = """" : oBusObj.GetValue ""ItemCodeDesc$"", sItemCodeDesc
Else
sItemCodeDesc = """" : oSession.AsObject(oBusObj.ExtendedDescriptionBusiness).GetValue ""ExtendedDescriptionText$"", sItemCodeDesc
End If
sItemCodeDesc = sItemCodeDesc & "" - "" & sItemCodeDesc
oBusObj.SetValue ""ItemCodeDesc$"", Left(sItemCodeDesc, 30)
If Len(sItemCodeDesc) > 30 Then
oSession.AsObject(oBusObj.ExtendedDescriptionBusiness).WriteExtendedDescription sExtendedDescriptionKey, sItemCodeDesc
sExtendedDescriptionKey = """" : sExtendedDescriptionKey = oSession.AsObject(oBusObj.ExtendedDescriptionBusiness).GetKey()
oBusObj.SetValueNoValidate ""ExtendedDescriptionKey$"", sExtendedDescriptionKey
End If
```
It starts by checking the current ExtendedDescriptionKey value to determine whether to grab the description from CI_Item or CI_ExtendedDescription.
It then simply adds the description to itself, this was done purely for testing, i know you will be forming the description using your UDFs so modify as needed.
It then sets ItemCodeDesc using only the first 30 characters and then checks if length is greater than 30, it will then use the WriteExtendedDescription method passing whatever the value is from ExtendedDescriptionKey, if it is blank or ""0000000000"", then it will create a new record with the next available key.
It then retrieves that key with GetKey and uses SetValueNoValidate to set it in CI_Item. I really prefer not to use SetValueNoValidate but i could not find and methods or properties or flags to get it to accept the key returned after WriteExtendedDescription. I'm not an MD so i don't have access to UI class for Item Maintenance, wish i knew what it was doing in there.