Skip to main content
Groovy Script - Distribute Form
Updated today

Description: Sample groovy script to distribute form to users, distribution groups, role or organizations.

Context: App

Remark: Supported in Post Mode Only

Script:

def execute() {

String subject = "Distribution From Groovy";

List<DistributionVO> distVoList = new ArrayList<DistributionVO>();

distributeForm(Recipient.USER, "user1@example.com", SystemActionsForms.ACTION_ASSIGN_STATUS, 22, distVoList);

distributeForm(Recipient.ROLE, "Example Role", SystemActionsForms.ACTION_FORM_RESPOND, 5, distVoList);

distributeForm(Recipient.ORG, "Example Org", SystemActionsForms.ACTION_FOR_INFORMATION, 2, distVoList);

distributeForm(Recipient.GROUP, "Example Form Dist Group", distVoList);

formService.distributeForm(distVoList, subject);

}

// For ORG, ROLE, USER.

def distributeForm(def recipientType, def recipientName, def actionName, def actionDueDays, def distVoList){

DistributionVO vo = new DistributionVO();

vo.setRecipientType(recipientType);

vo.setRecipientName(recipientName);

vo.setActionId(actionName);

vo.setDueDays(actionDueDays);

vo.setSendMail(true);

distVoList.add(vo);

}

// For only distribution group

def distributeForm(def recipientType, def recipientName, def distVoList){

distributeForm(recipientType, recipientName, 0, 0, distVoList);

}



Did this answer your question?