SOLVED

Betreff: How to download in a script USED BY info on the database?

Go to solution
ivanher
Level 1

How to download in a script USED BY info on the database?

i would like to download in an script this items, is there a standard field in the api that i could use to download the info from FIELDS USED BY?

Thanks

 
 

2021-09-10_11-31-24.jpg

 

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to download in a script USED BY info on the database?

Like Floyd says, there’s no (REST) API to fetch these dependent assets.

Are you trying to fetch them for all fields, or just for the currently highlighted field?

View solution in original post

7 REPLIES 7
Floyd_Alvares2
Level 8

Re: How to download in a script USED BY info on the database?

@ivanher 

From memory, I don't think there is an API that allows you to fetch the USED BY for fields.

There is a manual option to do it via the UI - but I assume that is not what you want.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to download in a script USED BY info on the database?

Like Floyd says, there’s no (REST) API to fetch these dependent assets.

Are you trying to fetch them for all fields, or just for the currently highlighted field?
ivanher
Level 1

Re: How to download in a script USED BY info on the database?

Thank you! well the goal was to download it that way, so i guess i got my answer, thank you!

Thorsten
Level 4

Betreff: How to download in a script USED BY info on the database?

I was looking at a similar problem just the other day. I put together a script I can run in the F12 console that will give you that page's Used-By, incl. text and link (I manually copy&paste those into a speadsheet to send to users to go and remove dependencies afterwards).

 

You might have to play a bit with the parameters/filters I used to make it work for your case, and replace the URL with your Marketo location.

// Scrape "Used-By" from Marketo Fields Management
let urls = document.getElementsByTagName("a");
for (let i = 0; i < urls.length; i++) {
  if (urls[i].getAttribute("href") != "#" && typeof urls[i].getAttribute("href") == "string") {
    if (urls[i].getAttribute("href").length > 5 && urls[i].innerText != "None" && urls[i].innerText != "Change Type In Progress") {
      console.log(urls[i].innerText + "," + "https://app-xxx.marketo.com/?meue&meueDataOnlyMode" + urls[i].getAttribute("href"));
    }
  }
}

 

See if that helps a bit.

ivanher
Level 1

Betreff: How to download in a script USED BY info on the database?

Hello, thanks for this i will use it, i really appreciate it!

SanfordWhiteman
Level 10 - Community Moderator

Betreff: How to download in a script USED BY info on the database?

Unfortunately, this won’t find all the Used By entries because Marketo has an “overflow” feature after which the fields are not shown but there’s a link to an XLS. IMO that should actually be the goal — to launch the XLS downloader for all fields.

 

P.S. Also, this is tighter (but has the same limitation of only getting the non-overflow entries):

var truncatedFieldList = Array.from(document.querySelectorAll(".mktListField a"))
  .filter( el => el.href != "#" && el.textContent.trim() )
  .map( el => el.textContent.trim() + "," + el.href );

console.log(truncatedFieldList.join("\n"));

 

ivanher
Level 1

Betreff: How to download in a script USED BY info on the database?

Will do Sir!

thanks