RE: DDMFormInstance

Jamie Sammons, modified 3 Years ago. New Member Posts: 10 Join Date: 11/26/21 Recent Posts

Hi All,

Is there any way available in Liferay 7.4 to get the "ddmFormInstance" by "Form name".

Thanks in advance:

Manoj Kumar

thumbnail
Russell Bohl, modified 3 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

Well, the localized form instance name is the same as the one appearing the Forms UI, at least for my Form (called "Untitled Form"). This Groovy script (tested in the Server Administration scripting console) demonstrates the type of service call you might make:

 

import com.liferay.dynamic.data.mapping.service.*;
import com.liferay.dynamic.data.mapping.model.*;
import com.liferay.portal.kernel.util.*;

for (DDMFormInstance instance:DDMFormInstanceLocalServiceUtil.getDDMFormInstances(-1,-1)) {

    if (instance.getName(Locale.ENGLISH)=="Untitled Form") {
        out.println("Untitled Form, Instance ID: " + instance.getFormInstanceId());
    }
    else {
        out.println("nope");
    }
}