Configuring Data Blocks
To begin configuring Dun & Bradstreet (D&B) data blocks, the D&B component model should be deployed first. Refer to Configuring a Different Direct+ Service for instructions on how to deploy the D&B component model. Once the component model has been deployed, a data model and setup objects are created to support the Company Profile with Executives, Linkage and Financials (CMPELF) product. Apply the updates listed below to change the configurations to use data block instead of CMPELF.
The following topics can be referenced to configure other D&B integration products:
D&B Configuration Updates
The following is an example of configuration updates required to make a data block request and parse the returned data.
Note: This topic assumes the Dun & Bradstreet Match integration has processed and the customer / supplier entity has obtained a DUNS number.
Gateway Integration Endpoint
Create a new REST Gateway and select the consumer key. To obtain this key, reach out to your Stibo Systems Account manager. If no consumer key is available in the dropdown, the license property must be set for the system. For assistance with this, contact Stibo Support. Use the following property and format:
DnBDirectPlus.Credentials = [Name, License, Secret]
Operation Configuration
Create a new Operation Configuration and select the D&B data blocks product (if not available, any product can be selected and the request query parameters will define what data and levels to return). Populate the additional parameters with new attributes to hold the specific integration info and JSON response for the Data Blocks request.
Enrichment Wrappers and Request Rule
Create two new business actions, a 'D&B Data blocks Enrichment Request', and a 'D&B Data Blocks Enrichment Wrapper'.
The wrapper should be used to execute the request rule, which must contain the query parameters for what data block levels to return as well as any necessary JavaScript for parsing and saving data into STEP.
The following JavaScript example is used for parsing into attributes and data containers.
dnbIntegrationContext.performDefaultEnrichingValidation(currentObject);
if (dnbIntegrationContext.getIntegrationResult().getIntegrationException()) {
return;
}
queryParams = new java.util.HashMap();
//queryParams.put("blockIDs", "diversityinsight_L1_v1,paymentinsight_L3_v1");
queryParams.put("blockIDs", "companyinfo_L3_v1,principalscontacts_L3_v2");
queryParams.put("tradeUp", "hq");
var dnbOrg = currentObject.getDnbOrganization();
const dunsNumberSingleValue = dnbOrg.getValue("DnBDUNSNumber");
var dunsNumber = dunsNumberSingleValue.getValue();
for(i=dunsNumber.length(); i<9; i++) {
dunsNumber = "0" + dunsNumber;
}
//Using this D&BEnrichConfigDataBlocks config to set integration status attributes, even though 'D&B Product' is set to 'Analytics Assessment Material Change (aasmcu)' The 'D&B Product' setting is not used.
var operationConfiguration = currentObject.getManager().getHome(com.stibo.core.domain.setupentity.SetupEntityHome).getSetupEntityByID('D&BEnrichConfigDataBlocks'); //enrichOperationConfigurationID);
var get = dnbGateway.rest().get();
get.path("/v1/data/duns/" + dunsNumber);
get.pathQuery(queryParams);
get.header("Content-Type", "application/json");
dnbIntegrationContext.setOperationConfiguration(operationConfiguration);
jsonResult = get.invoke();
//Save the JSON
dnbOrg.setSimpleValue(DnBJSONDataBlocks, jsonResult);
//Default built-in enrichment data mapping
dnbIntegrationContext.performDefaultEnrichingDataMapping(currentObject, jsonResult);
The following example uses CMPELF, however, the pattern to parse and save applies for D&B products:
var dnbResultCMPELF = dnbManager.executeBusinessActionWithDnbIntegrationContext(dnbEnrichRequestCMPELF);
if (dnbResultCMPELF.getIntegrationException()) {
dataIssuesReport.addError(dnbResultCMPELF.getIntegrationException().getMessage(), currentObject, enrichIntegrationStatusAttributeCMPELF);
} else {
//Get the JSON
var dnbOrganization = currentObject.getDnbOrganization();
var jsonResult = dnbOrganization.getValue('DnBJSONCompanyProfileData').getSimpleValue();
//log.info(jsonResult);
var responseObject = JSON.parse(jsonResult);
//Deleting existing DnBFinancials DCs
deleteDcs(dnbOrganization, "DnBFinancials");
//Saving D&B Financials data from responseObject.organization in Step
if (responseObject.organization.financials != null) {
for (index = 0; index < responseObject.organization.financials.length; ++index) {
var financial = responseObject.organization.financials[index];
var dco = addDataContainerObject(dnbOrganization, "DnBFinancials");
var targetAttr = dco.getValue('DnBReliabilityDnBCode');
targetAttr.setSimpleValue(financial.reliabilityDnBCode);
targetAttr = dco.getValue('DnBReliabilityDescription');
targetAttr.setSimpleValue(financial.reliabilityDescription);
targetAttr = dco.getValue('DnBFinancialStatementToDate');
targetAttr.setSimpleValue(financial.financialStatementToDate);
if (financial.yearlyRevenue != null && financial.yearlyRevenue.length > 0) {
targetAttr = dco.getValue('DnBYearlyRevenue');
var yearlyRevenue = financial.yearlyRevenue[0];
targetAttr.setSimpleValue(yearlyRevenue.value + ' ' + yearlyRevenue.currency);
}
}
}
}
return dataIssuesReport;
function deleteDcs(node, dctID) {
//log.info("Getting data containers of node " + node.getID() + " for data container type " + dctID);
var dcWrapper = node.getDataContainerByTypeID(dctID);
dcWrapper.deleteLocal();
}
function addDataContainerObject(node, dctID) {
//log.info("Adding data container object in node " + node.getID() + " for data container type " + dctID);
var dcWrapper = node.getDataContainerByTypeID(dctID);
var singleContainer = null;
var dco = null;
if (dcWrapper instanceof com.stibo.core.domain.datacontainer.MultiDataContainer) {
singleContainer = dcWrapper.addDataContainer();
} else {
warning("Data container type " + dctID + " is a single data container, cannot add a new one");
}
try {
dco = singleContainer.createDataContainerObject(null);
//log.info("Added new data container object in node " + node.getID() + " for data container type " + dctID);
return dco;
} catch (exception) {
warning("Could not create new data container object of type " + dctID + " in node with ID: " + node.getID());
warning(exception);
}
}