1

There is a post from 2019 here that details obtaining a couple of fields about a Lightning Web Component.

Is there a way to get that information programmatically? Could not tell if trying various combinations of LightningComponentBundle in th dev console would even work since every variation returned a sObject type 'myVariation' is not supported.

Also tried similar queries via the dx cli using sfdx force:data:soql:query -q "SELECT Id FROM LightningComponentBundle"

1

You can get the Last Modified Date of a component bundle, but not the individual files therein.

Command

sfdx force:mdapi:listmetadata -m LightningComponentBundle

Example Output (redacted)

{
  "status": 0,
  "result": [
    {
      "createdById": "005...",
      "createdByName": "Brian Fear",
      "createdDate": "2019-07-16T13:17:55.000Z",
      "fileName": "lwc/...",
      "fullName": "...",
      "id": "0Rb...",
      "lastModifiedById": "005...",
      "lastModifiedByName": "Brian Fear",
      "lastModifiedDate": "2019-07-16T13:17:55.000Z",
      "manageableState": "unmanaged",
      "namespacePrefix": "",
      "type": "LightningComponentBundle"
    },
    {
      "createdById": "005...",
      "createdByName": "Brian Fear",
      "createdDate": "2019-03-27T16:18:13.000Z",
      "fileName": "lwc/...",
      "fullName": "...",
      "id": "0Rb...",
      "lastModifiedById": "005...",
      "lastModifiedByName": "Brian Fear",
      "lastModifiedDate": "2019-07-09T00:24:07.000Z",
      "manageableState": "unmanaged",
      "namespacePrefix": "",
      "type": "LightningComponentBundle"
    },
    {
      "createdById": "005",
      "createdByName": "Brian Fear",
      "createdDate": "2019-04-10T02:26:33.000Z",
      "fileName": "lwc/...",
      "fullName": "...",
      "id": "0Rb...",
      "lastModifiedById": "005...",
      "lastModifiedByName": "Brian Fear",
      "lastModifiedDate": "2019-07-09T00:24:07.000Z",
      "manageableState": "unmanaged",
      "namespacePrefix": "",
      "type": "LightningComponentBundle"
    },
    {
      "createdById": "005",
      "createdByName": "Brian Fear",
      "createdDate": "2019-08-20T23:03:31.000Z",
      "fileName": "lwc/...",
      "fullName": "...",
      "id": "0Rb...",
      "lastModifiedById": "005...",
      "lastModifiedByName": "Brian Fear",
      "lastModifiedDate": "2019-08-20T23:03:31.000Z",
      "manageableState": "unmanaged",
      "namespacePrefix": "",
      "type": "LightningComponentBundle"
    }
  ]
}

Note that all times are in GMT.

To keep track of created/last-modified times of individual files, consider using a VCS (Version Control System), such as Git. You'll be able to track specific changes to files efficiently this way.

| improve this answer | |
  • Thanks @sfdcfox that was exactly what I needed to know! – trebleCode Feb 5 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.