Thursday, 5 April 2018

OIM API - Code Snippet to Read Email Definition Data for the given Email Definition Name.

public void readEmailDefinitionData(String emailDefinitionName){
        String subject = "";
        String body = "";

        Map<String, String> emailDefinitionNameMap = new HashMap<String, String>();
        emailDefinitionNameMap.put("Email Definition.Name", emailDefinitionName);

        try{
            tcEmailOperationsIntf intf = Platform.getService(tcEmailOperationsIntf.class);

            tcResultSet rs = intf.findEmailDefinition(emailDefinitionNameMap);

            rs.goToRow(0);

            subject = rs.getStringValue("Email Definition.Subject");
            body = rs.getStringValue("Email Definition.Body");

            System.out.println("Subject : "+ subject);
            System.out.println("Body : "+ body);

        }catch (Exception e){
               System.out.println("Error occured while fetching email definition data - " + e);
        }
}


Happy Learning!!!

No comments:

Post a Comment