In IFS Cloud, I encountered a peculiar behavior of macro attributes of the type date. The system has been set up in such a way, that in documents connected to the object CompanyPerson the employee's date of birth can be shown (core attribute Company_Person.Date_Of_Birth). In the document, however, the date shown is the actual birth date minus 1. E.g. when the employee's date of birth is 1 January 1990, the date shown in the document is 31 December 1989. What could be the cause of this behavior and, more important, how can it be solved?
Thanks in advance for your reactions.
Page 1 / 1
Hi @Martin Hulsenboom
That is a very strange case indeed. Would you mind sharing the macro code here?
IF LEN(ATTRVALUE(STAG)) = 19 AND MID(ATTRVALUE(STAG),5,1) = "-" AND MID(ATTRVALUE(STAG),8,1) = "-" AND MID(ATTRVALUE(STAG),11,1) = "-" AND MID(ATTRVALUE(STAG),14,1) = "." AND MID(ATTRVALUE(STAG),17,1) = "." THEN
Then we will see if the value as extracted from the macro is wrong or if Word is doing something with the value.
I suspect the value is already wrong when the macro gets it, but that remains to be seen.
Which attribute did you pick in the basic data for macro attributes?
Hi Mathias,
Thanks for your reaction. I have added the code you mentioned, but I cannot see a message. What I do notice, is that the system doesn't automatically open Word anymore. When I open the document manually, I still see the wrong values.
As for the attributes: I have kept it very simple. It was a first test in order to give the customer an impression of what we are able to. Note, that I have defined two date fields: a custom field (the jubilee hire date) and a core field (birth date). In both cases, the shown values are wrong.
@Mathias Dahl , And to verify what I've done in the code itself:
Hi,
I know what the problem is. My mistake. I didn't not tell you how to add a message box, just what it should output.
You need to wrap what you added there in a call to MsgBox(...). Should be something like this (untested, typing this on my phone):
MsgBox(MID(ATTRVALUE(STAG),1,10))
I recommend to have a developer as part of the implementation/project team if you plan to produce new macros, or even work with existing ones. Macros are not officially a customization, but it does involve writing code.
Hi @Mathias Dahl , The message is showing the correct date… So, this implies that it should be something in Word? Best regards, Martin
Good finding!
I have a crazy idea for you to try. Not tested and not thought through...
I noticed something about the code that handles that separate case:
See the "3" there? Other properties are added with "4". My guess is that "3" might mean that the property is a date and not a string. See what happens if you change it to "4"…
Seems I was right :)
The third parameter there is the type and these are the ones available: