10 Replies Latest reply on Jul 17, 2017 4:42 AM by Vaishali Ahlawat

    Adding New Value in Financial Section of Organization Dashboard in C360 10.2

    Vaishali Ahlawat Guru

      Hi,

      I got a requirement for adding new value in financial section of organization dashboard in C360.

       

      I saw the code they are using for B2BFin , this is java script and ajax call which I am new to.

       

      Anyone have any idea how the code is fethching values of AnnualRevenue and Equity in that section?

       

      From where the values like " mdm.entity360view.ConfigContour.widgets.b2b.financal.section.length " are coming.


      I am sharing the code , if anyone can give any type of help that would be greatly appreciable.

       

       

        <style>

        div[id$='b2bFinancial'] .component-section-field-value {

         font-size: 1.308em;

         font-family: FuturaPT-medium;

        }

        </style>

       

        <div class="mdm-ui-section">

          <div class="mdm-ui-component-header">

            <div class="mdm-ui-component-title" id="componenTitle{{rowidObject}}b2bFinancial"></div>

          </div>

         /* rowidObject of what  */ <div id="componentBody{{rowidObject}}b2bFinancial" class="mdm-ui-component-body body-fixed-height">

          </div>

      </div>

      <script type="text/javascript">

      $("#componenTitle" + {{rowidObject}} + "b2bFinancial").text(mdm.entity360view.ConfigContour.widgets.b2b.financal.title);

       

       

      var context = %%context%%;

      var url = '/cmx/cs/' + context.getOrsId() + '/' + context.getBeType() + '/' + context.getRootRowId();

       

       

      $.ajax(url, {

              cache : false,

              dataType: 'json',

              data : {

                  depth: 10,

                  readSystemFields: true,

                  recordStates :'ACTIVE,PENDING'

              }

          }).done(function(resultData){

       

        for(var i = 0, l = mdm.entity360view.ConfigContour.widgets.b2b.financal.section.length ;  i < l; i++) {

        $("#componentBody" + {{rowidObject}} + "b2bFinancial").append('<div class="component-section" id="componentSection' +  {{rowidObject}} + i + 'b2bFinancial" style="width:' + (100/l) + '%;"></div>');

        if($.isArray(mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field)) {

        for (var j = 0, jl = mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.length; j < jl ; j++) {

        $("#componentSection" +  {{rowidObject}} + i + "b2bFinancial" ).append('<div class="component-section-field" id="componentSectionField' +  {{rowidObject}} + (i + "" +j) + 'b2bFinancial" ></div>');

        $("#componentSectionField" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial").append('<div class="component-section-field-label" id="componentSectionFieldlabel' +  {{rowidObject}} + (i + "" +j) + 'b2bFinancial"></div>');

        $("#componentSectionFieldlabel" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial").text(mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].label);

        $("#componentSectionField" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial").append('<div class="component-section-field-value" id="componentSectionFieldValue' +  {{rowidObject}} + (i + "" +j) + 'b2bFinancial"></div>');

       

        if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].type === 'img') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial").append( $('<img class="img-responsive" />').attr('src', mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].getStrategy)) );

        } else if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].type === 'email') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial" ).append( $('<a />').attr('href', 'mailto:' + mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].getStrategy) ).text(mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].getStrategy)) );

        } else if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].type === 'currency') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial" ).append(mdm.entity360view.helperUtil.formatAsCurrency(mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].getStrategy), 'en-US', mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue));

        } else {

        $("#componentSectionFieldValue" +  {{rowidObject}} + (i + "" +j) + "b2bFinancial" ).text(mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].getStrategy).replace(/undefined/g, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field[j].defaultValue));

        }

        }

        } else {

        $("#componentSection" +  {{rowidObject}} + i + "b2bFinancial").append('<div class="component-section-field" id="componentSectionField' +  {{rowidObject}} + i + 'b2bFinancial" ></div>');

        $("#componentSectionField" +  {{rowidObject}} + i + "b2bFinancial").append('<div class="component-section-field-label" id="componentSectionFieldLabel' +  {{rowidObject}} + i + 'b2bFinancial"></div>');

        $("#componentSectionFieldLabel" +  {{rowidObject}} + i + "b2bFinancial" ).text(mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.label);

        $("#componentSectionField" +  {{rowidObject}} + i + "b2bFinancial" ).append('<div class="component-section-field-value" id="componentSectionFieldValue' +  {{rowidObject}} + i + 'b2bFinancial"></div>');

        if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.type === 'img') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + i + "b2bFinancial").append( $('<img class="img-responsive" />').attr('src', mdm.entity360view.helperUtil.getData(resultData ,mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.getStrategy)) );

        } else if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.type === 'email') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + i + "b2bFinancial" ).append( $('<a />').attr('href', 'mailto:' + mdm.entity360view.helperUtil.getData(resultData ,mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.getStrategy) ).text(mdm.entity360view.helperUtil.getData(resultData ,mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.getStrategy)) );

        } else if (mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.type === 'currency') {

        $("#componentSectionFieldValue" +  {{rowidObject}} + i + "b2bFinancial" ).append(mdm.entity360view.helperUtil.formatAsCurrency(mdm.entity360view.helperUtil.getData(resultData, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith,  mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.getStrategy), 'en-US', mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue));

        } else {

        $("#componentSectionFieldValue" +  {{rowidObject}} + i + "b2bFinancial").text(mdm.entity360view.helperUtil.getData(resultData ,mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKey, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultKeyValue, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.coFieldValues, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.concatenateWith, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.getStrategy).replace(/undefined/g, mdm.entity360view.ConfigContour.widgets.b2b.financal.section[i].field.defaultValue));

        }

        }

      }

        });

      </script>

       

      Thanks

      Vaishali