Hello,
We are using a custom Java trigger when creating/updating an object. Object has a parent-child relation to another object. We can see the parent object information in the trigger method, but we also need children object information. Is there a way we can see/get child object information in a trigger set on the parent object of a relation?
Kind regards,
Nicoleta Riter
Hello,
Can you provide the code you are using for this custom java trigger?
Thank you,
Gian
I can not provide the exact code, but this is a glance of what I am trying:
public class CustomTrigger extends RuntimeTrigger {
public CustomTrigger(TriggerDef triggerDef, DataObject data,
Date eventDate) {
super(triggerDef, data, eventDate);
}
@Override
public void trigger(TriggerRunner triggerRunner) throws Exception {
Person person = new Person();
String name = m_data.getFieldValue("name").toString();
String surname = m_data.getFieldValue("surname").toString();
// get relatives of a person from a child table of Person
List<Relatives> relatives = m_data.getFieldValue("relatives");
}
}
The problem that I'm facing is as follows: I have a trigger in Rollbase on table A, and table A has a one to many relation with table B, in Java when I access m_data object, I can see all fields of table A, but the fields of B look like this: [J@6ea4a825. Is there a posibility to get the list of B objects from this [J@6ea4a825?
Hello,
Excuse me for asking but,
Why do you feel the need of having a custom Java trigger?
We have been using Rollbase for 3 years on advanced issues and we never really needed it and always found workarounds in Rollbase.
Regards,
Romain
We need to call a soap webservice and this is the current solution that we have.
Hello,
Since you have a 1-many relationship it might be returning an array of data. Can you parse the return value to see if it is indeed an array?
Thank you,
Gian
Hello,
I am reading the Java document and there is a Java method called getAllRelated(). I think this is what you need to get all related object's field info and then use the getFieldValue again for each return object.
Let me know if I understand the question.
Thank you,
Gian
Hello,
Can you send a link with the Java document where you found this information? The object that I am using, m_data, does not have method getAllRelated() available.
Yes, you understood the question well.
Thank you,
Nicoleta
You can use APIs defined in RelationshipHandler class:
RelationshipHandler.getObjects(RelationshipDef rel, DataObject data1, com.rb.util.interfaces.IUser user)
Hello,
You can access it here: https://www.progress.com/products/rollbase/try/try-it/private-cloud.
After logging in, you can download the Custom Development Toolkit zip file. After downloading the file you can open the html page from customt > JavaDoc > index.html and go to the Relationship Class Page.
Thank you,
Gian