Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
TeamSite
TeamSite, LiveSite and OpenDeploy
FormAPI getChildren() on replicant returns null
System
If you have a replicant that allows zero instances, if the user does not create an instance of the replicant, getChildren() will return null. If you try to access the length property (to determine the number of instances), your code will fail. This can be pretty confusing if you have an onSave trigger that tries to do something to all of the instances - it won't save and may not even give an error message. So you have to first check that getChildren() does not return null before you check the length property.
if ( IWDatacapture.getItem( "/Replicant" ).getChildren() != null )
{
for( i = 0 ; i < IWDatacapture.getItem( "/Replicant" ).getChildren().length ; i++ )
{
// do your thing
}
}
Find more posts tagged with
Comments
There are no comments yet