GUID processing

0
I have three different data objects that I need to address from 1 (trace) table. So I need to store the type-of-table and the guid. I use a microflow to create a record in the trace table. Can't figure out how to fill the long 'original-guid' field in that table from the original record. Is there a way to do this?
asked
2 answers
1

Would it be possible to have all three entities use the same generalisation? Then you can create an association from your trace table to the entity all other entities use as generalisation.

If this is not possible, you could use a string or long integer column in your trace table. If you create a Java action that has an anyObject parameter and returns a long or string, you can get the guid in Java. Maybe someone else can help you with a better way to get the guid.

Or: could the audit trail module from the appstore help you trace your objects?

answered
1

If you need to generate a GUID:

import java.util.UUID; import com.mendix.systemwideinterfaces.core.UserAction;

/** * This action will generate a GUID that can be associated with an Obejct of Choice. */ public class GenerateGUID extends UserAction<string> { public GenerateGUID() { super(); }

@Override
public String executeAction() throws Exception
{
    // BEGIN USER CODE
    UUID idOne = UUID.randomUUID();
    return String.valueOf(idOne);
    // END USER CODE
}

/**
 * Returns a string representation of this action
 */
@Override
public String toString()
{
    return "GenerateGUID";
}

// BEGIN EXTRA CODE
// END EXTRA CODE

}

answered