cancel
Showing results for 
Search instead for 
Did you mean: 

2 Custom Buttons to start 2 different Datafeeds

AlexandrosKras
Collaborator III

Hi all,

I have an issue with 2 custom buttons for 2 datafeeds. When they start in the same section they mess up and always the 2nd start.

I attach the code datafeed1.txt & datafeed2.txt - which i cannot find any differences - any idea?

 

4 REPLIES 4

DavidPetty
Archer Employee
Archer Employee

@AlexandrosKras, see how this works.

Try putting this at the very bottom of the layout:

 

<style>
     #dbrn-btn-generate {
          background-color: transparent;
          margin: 1% 0% 1% 7%;
     }
     #dbrnalertMsg{
          color:#555;
          border-radius:10px;
          font-family: Tahoma;font-size:12px;        
          padding:10px 10px 10px 36px;
          position: fixed;
          top: 0;
          left: 0;
          height: 1em;
          width: 100%;
          background-color: #e9ffd9;
          z-index: 999;
          font-weight:bold;
     }
</style>

<script type="text/javascript">
     var NOTIFICATIONdatafeedGUID = '8F4CE42D-9BB0-4E6B-B72C-60A2CE64505E';
     var ASSESSMENTdatafeedGUID = '931CEA7B-411C-437E-A8F3-AF30CE965B72';
     var baseURL = 'https://.../RSAarcher';     // Build the base URL from address bar

     Sys.Application.add_load( function() {

          if (sessionStorage.getItem("type")=='dbrn') {
               document.getElementById("dbrnalertMsg").style.display = "block";
               setTimeout( function(){document.getElementById("dbrnalertMsg").style.display = "none";}, 10000);
               sessionStorage.removeItem("type");
          } else if (sessionStorage.getItem("type")=='dbra') {
               document.getElementById("dbraalertMsg").style.display = "block";
               setTimeout( function(){document.getElementById("dbraalertMsg").style.display = "none";}, 10000);
               sessionStorage.removeItem("type");
          }
     });

     function executedatafeed(feedGUID,type){ 
          var restAPICall = {"DataFeedGuid":feedGUID, "IsReferenceFeedsIncluded":true};
          $.ajax({
               type: "POST",
               url: baseURL+'/api/core/datafeed/execution',
               headers: {
                    'x-csrf-token': (window.sessionStorage) ? window.sessionStorage.getItem("x-csrf-token") : csrfToken = parent.parent.ArcherApp.globals['xCsrfToken']
               },
               data: JSON.stringify(restAPICall),
               contentType: 'application/json',
               processData: false,
               dataType: 'json',
               success: function() {       
                    sessionStorage.setItem("type", type);
                    $('#master_btnApply').click();},
               error: function() {alert("An unexpected error has occurred in the system. Please try your request again. If problems persist, please contact your system administrator")}
          });
     }
</script>

Then put your buttons where you need it.

<div id="dbrn-toolbar-app-buttons">
     <a id="dbrn-btn-capture" href="javascript&colon;void(0);" data-check-dirty="false">
         <div id="dbrn-btn-generate" class="tb-btn" data-icon="&#xE08F" data-icon-pos="left" onclick="executedatafeed(NOTIFICATIONdatafeedGUID, 'dbrn');">COPY NOTIFICATION FORM FIELDS TO ASSESSMENT</div>
     </a>
</div>
<div id="dbrnalertMsg" style="display:none"><span>SUCCESS: </span>Fields copy process has started successful. Please refresh or recalculate the record.</div>

and

<div id="dbra-toolbar-app-buttons">
     <a id="dbra-btn-capture" href="javascript&colon;void(0);" data-check-dirty="false">
         <div id="dbra-btn-generate" class="tb-btn" data-icon="&#xE08F" data-icon-pos="left" onclick="executedatafeed(ASSESSMENTdatafeedGUID, 'dbra');">COPY ASSESSMENT FORM FIELDS TO REGISTER</div>
     </a>
</div>
<div id="dbraalertMsg" style="display:none"><span>SUCCESS: </span>Fields copy process has started successful. Please refresh or recalculate the record.</div>

 

 Advisory Consultant - Archer, an RSA Business

Hi there,

All work fine for starting the different dataffeds, only second (of the second datafeed)success msg does not show
Any idea?

Anything showing up in the browser's developer tools console?

 Advisory Consultant - Archer, an RSA Business

Hi there-

I fixed it

It did show for the one feed.

Had to add another section for the second feed success message. at the style customobject.