Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Map<String, Object> params = new HashMap<String, Object>();
params.put("container", true);          // Creates a container (HTML table or div) around the form.
params.put("center", false);            // Center the container on the page if desired.
params.put("resize", true);             // Automatically resize the container as the form's height changes.
// First, check if there is a SAVED task for the formTypeId in question.
String formUrl = null;
TaskFeed sFeed = service.getFeed(service.getFeedURL(TaskFeed.class), TaskFeed.class);
for (TaskEntry sEntry : sFeed.getEntries()) {
    if (!("SAVED".equals(sEntry.getState())))
        continue;
    if (!sEntry.getFormTypeEmbedLink(null).getHref().contains("_iAMawOa4Ed-TkpzYF5hpcQ"))
        continue;
    formUrl = sEntry.getFormTypeEmbedLink(params).getHref();
    break;
}
if (formUrl == null) {
        // No saved task found. Create a new form instance.
        FormTypeEntry ftEntry = (FormTypeEntry) service.getEntry(
        service.getEntryURL(FormTypeEntry.class, "_iAMawOa4Ed-TkpzYF5hpcQ!_MOrvYeV9Ed-6Ft_YAwCXMQ!designer"),
        FormTypeEntry.class);
        formUrl = ftEntry.getFormTypeEmbedLink(params).getHref();
}
<script src="<%= formUrl %>" type="text/javascript" language="Javascript"></script>