How to access system members from Java action?

2
Hi All, I am writing a java action to export the records to excel file. I want to export the system members values also. But I don't know how to get system members(createdDate, changedDate, owner, changedBy) to Java action. I tried to get the values of system members same as the variables in the entity. But I don't see the system members in the list of variables available in Eclipse IDE. Can you please help me with this. Also, I have one more question on date format. I am exporting the event end date to excel file. But it is giving the string value in the below format. "Thu Mar 14 00:00:00 IST 2019". But I want this date in "mm-dd-yyyy” format without time. Please help me. Thanks in advance. Regards, Venkat
asked
1 answers
5

Hello Venkatesh,

For 1 you can retrieve the system attributes from the IMendixObject via the generic get method:. You could do something like:

myObj.getMendixObject().getValue(context, "createdDate");

For 2 you can use a java formatter like SimpleDateFormat if you are processing this yourself.

Edit: I’ve found some code I’ve used for parsing and made it into a format example, see below: 

DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
String myFormattedDate = df.format(date);

Hope this helps

answered