R
Robert Brown
HI.
I have a custom form within a Public Folder for Mail/Post items. On
this form I have created a NEW field called DAYS and set a value of 0
as the default.
Within the folder View, I have added the Days Column.
When a new email arrives to this public folder, I apply the new custom
form without a problem, but the column for DAYS is blank. If I open
the item, the field DAYS has the default value in it. If I close the
item (without saving it) the column is still blank in the folder view.
If I actually save it, then the column will display the default value
of 0.
Ok, what I am trying to achieve is that when the new item arrives the
default value is "posted" whatever with the form. I then have a
VBScript that runs at 4pm each day, and increments the DAYS value.
Once it gets to a certain day count, I automatically email an
auto-response.
The problem is that if the mail item has not been saved prior to
this(by opening it and then saving it manually), then I get a MAPI-E
error stating the object doesnt exist when I try to retreive the value
through a vbscript. I can't even programmatically insert a value until
the manual save is done. Once I have done the manual save, the
vbscript works perfectly with no errors.
I presumed that when a mail item arrived it was being "saved" like
when a manual post has occured. So, what can I do to fix this. Should
I put some code in the custom form to fire when the item is created?
Has anyone got any ideas?
Below is the code i use to read the field. Presume that I have opened
a mapi session and have navigated to the folder/subfolder in question.
Thanks,
Robert
set objMessages = objSubFolder.Messages
for each objMessage in objMessages
set objFields = objMessage.fields
set objField = objFields.item("Days")
zz = cint(objField)
objFields.item("Days").value = CStr(zz+1)
objmessage.update
next
I have a custom form within a Public Folder for Mail/Post items. On
this form I have created a NEW field called DAYS and set a value of 0
as the default.
Within the folder View, I have added the Days Column.
When a new email arrives to this public folder, I apply the new custom
form without a problem, but the column for DAYS is blank. If I open
the item, the field DAYS has the default value in it. If I close the
item (without saving it) the column is still blank in the folder view.
If I actually save it, then the column will display the default value
of 0.
Ok, what I am trying to achieve is that when the new item arrives the
default value is "posted" whatever with the form. I then have a
VBScript that runs at 4pm each day, and increments the DAYS value.
Once it gets to a certain day count, I automatically email an
auto-response.
The problem is that if the mail item has not been saved prior to
this(by opening it and then saving it manually), then I get a MAPI-E
error stating the object doesnt exist when I try to retreive the value
through a vbscript. I can't even programmatically insert a value until
the manual save is done. Once I have done the manual save, the
vbscript works perfectly with no errors.
I presumed that when a mail item arrived it was being "saved" like
when a manual post has occured. So, what can I do to fix this. Should
I put some code in the custom form to fire when the item is created?
Has anyone got any ideas?
Below is the code i use to read the field. Presume that I have opened
a mapi session and have navigated to the folder/subfolder in question.
Thanks,
Robert
set objMessages = objSubFolder.Messages
for each objMessage in objMessages
set objFields = objMessage.fields
set objField = objFields.item("Days")
zz = cint(objField)
objFields.item("Days").value = CStr(zz+1)
objmessage.update
next