Accenture / Accenture/sfmc-devtools-vscode

[FEATURE] resolve "ContentBlockById(...)" to key/name via right click on code?

Open
#154 2 comments 0 reactions 1 assignee View on GitHub

@anasilva105 is already working on this.

Since Aug 13, 2024.

enhancement NEW
Dominant language
TypeScript
Stars
7
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Some instances use statements like %%=ContentBlockByID("2731")=%% a lot.
That's actually considered best practice by the vendor because it cannot be "accidentally changed" like the name. Ok, same is likely true for the key but I suppose that can still be changed if one wants to.

Regardless, this presents as a problem because it makes the code unreadable and I wanted a quick way to resolve that Id and be able to open the actual content block in VSCode. Therefore we got this ticket:

it works like this:

request:

mcdev resolveId myCred/myBU asset 2463 --json

# or

mcdev rid myCred/myBU asset 2463 --json

response:

{
  "key": "35aa172d-2212-4b3d-b220-e01104394a9b",
  "name": "my super-duper cool content block",
  "path": "./retrieve/myCred/myBU/asset/block/35aa172d-2212-4b3d-b220-e01104394a9b.asset-block-meta.json"
}

See how I already added the json version for you ;-)

Alternatively, it looks like this:

mcdev rid myCred/myBU asset 2463       
11:00:32 info: mcdev:: resolveId
11:00:32 info:  - Searching asset with id 2463 on BU myCred/myBU
11:00:33 info:  - asset-block found: 35aa172d-2212-4b3d-b220-e01104394a9b (my super-duper cool content block)
11:00:33 info:  - link: ./retrieve/myCred/myBU/asset/block/35aa172d-2212-4b3d-b220-e01104394a9b.asset-block-meta.json

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.