as above. The drop-down list that supposed to list all the Marketo forms is empty. All I get is a message that says "Unable to load forms"
setup:
Things I did to investigate/setup Marketo in AEM:
from ACS-commons - MarketoFormDataSource class
MarketoClientConfigurationManager cfgMgr = request.adaptTo(MarketoClientConfigurationManager.class);
if (cfgMgr != null) {
config = cfgMgr.getConfiguration();
}
if (config == null) {
String msg = String.format("No Marketo configuration found for resource '%s'",
request.getRequestPathInfo().getSuffix());
throw new RepositoryException(msg);
}
--------------
from ACS-commons - MarketoClientConfigurationManagerImpl class (this class/function returns a null - i.e. cannot see my config)
return configRsrcRslvr.getResourceCollection(resource, "settings", "cloudconfigs").stream().filter(c -> {
boolean matches = "/apps/acs-commons/templates/utilities/marketocloudconfig"
.equals(c.getValueMap().get("jcr:content/cq:template", ""));
log.debug("Resource: {} matches: {}", c, matches);
return matches;
}).findFirst().map(c -> c.getChild(JcrConstants.JCR_CONTENT)).map(c -> c.adaptTo(MarketoClientConfiguration.class))
.orElse(null);
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @jayv25585659 ,
To me it seems that the configuration credentials you are using on lower environment are not correct due to which you may be getting an exception while making an API call to Marketo.
See following code snippet from MarketoFormDataSource.java
options = formCache.get(config).stream() .sorted((MarketoForm f1, MarketoForm f2) -> f1.getName().compareTo(f2.getName())).map(f -> { Map<String, Object> data = new HashMap<>(); data.put("selected", currentValue == f.getId()); data.put("value", f.getId()); data.put("text", String.format("%s [%s] (%s)", f.getName(), f.getLocale(), f.getId())); return new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data)); }).collect(Collectors.toList()); log.debug("Loaded {} options", options.size()); } catch (Exception e) { log.warn("Failed to load Marketo forms", e); options = new ArrayList<>(); Map<String, Object> data = new HashMap<>(); data.put("value", ""); data.put("text", "Unable to load forms from Marketo"); options.add(new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data))); }
You can manually check making the Rest API calls as coded under MarketoClientImpl.java to first extract the bearer token and the use it to call forms API to pull in all forms details from Marketo.
Hope this helps!
Hi @jayv25585659 ,
To me it seems that the configuration credentials you are using on lower environment are not correct due to which you may be getting an exception while making an API call to Marketo.
See following code snippet from MarketoFormDataSource.java
options = formCache.get(config).stream() .sorted((MarketoForm f1, MarketoForm f2) -> f1.getName().compareTo(f2.getName())).map(f -> { Map<String, Object> data = new HashMap<>(); data.put("selected", currentValue == f.getId()); data.put("value", f.getId()); data.put("text", String.format("%s [%s] (%s)", f.getName(), f.getLocale(), f.getId())); return new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data)); }).collect(Collectors.toList()); log.debug("Loaded {} options", options.size()); } catch (Exception e) { log.warn("Failed to load Marketo forms", e); options = new ArrayList<>(); Map<String, Object> data = new HashMap<>(); data.put("value", ""); data.put("text", "Unable to load forms from Marketo"); options.add(new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data))); }
You can manually check making the Rest API calls as coded under MarketoClientImpl.java to first extract the bearer token and the use it to call forms API to pull in all forms details from Marketo.
Hope this helps!