Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Datafeed Custom buttons conflicting

AlexandrosKras
Collaborator III

Hi all,

 

Can someone assist me in the following issue:

I have two datafeeds running through two custom object buttons in the same page.

As it seems the system runs always the second one (if you put a second)

 

I attach the code for feed 1 and feed 2 - if someone can spot the issue...

1 ACCEPTED SOLUTION

Accepted Solutions

DavidPetty
Archer Employee
Archer Employee

Alexandors, change the datafeedGUID variable to be unique for each button for the feeds.  When you add the second data feed button it replaces the data feed GUID from the first data feed button

 Advisory Consultant

View solution in original post

3 REPLIES 3

DavidPetty
Archer Employee
Archer Employee

Alexandors, change the datafeedGUID variable to be unique for each button for the feeds.  When you add the second data feed button it replaces the data feed GUID from the first data feed button

 Advisory Consultant

Hi David,

I have put them in different tabs and they work fine...

But your solution seems to be safest - will try it now and update here

 

One more question: could somehow share some code for having an update through some button or to a field for the successful completion of the feed(s)s?

 

Thanx in advance -

Alexandros

Alexandors, you can add this function to poll the feed status, update the success if statements to perform any action you need. In your .ajax success call this function.

function pollDataFeedStatus(){
$.ajax({
type: "POST",
url: baseURL+'/api/core/datafeed/history/recent',
headers: {
'x-csrf-token': (window.sessionStorage) ? window.sessionStorage.getItem("x-csrf-token") : parent.parent.ArcherApp.globals['xCsrfToken'],
'X-Http-Method-Override' :'GET'
},
data: JSON.stringify({"Guid": datafeedGUID}),
contentType: 'application/json',
processData: false,
dataType: 'json',
success: function(data) {
var status = data.RequestedObject.Status;
if(status == 1 || status == 7) {
// Feed Running or Pending

// Continue checking feed status
setTimeout(pollDataFeedStatus,5000)
} else if (status == 2 || status == 4) {
// Feed Completed or Warning

} else {
// Feed Faulted, Terminating or Terminated

}
},
error: function() {
// Error occurred
}
});
}

 

 Advisory Consultant