function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Retrieve Weblink metadata

In my current development org, I add a custom link on an object which is defined in a managed package. Now I am trying to persist the metadata and then migrate this custom link to another org. According to Migration Tool Guide, <Type> element with value 'Weblink' should be manually specified in package.xml. It also says, 'this type is retrieved or deployed as part of a custom object file. You must dot-qualify the object name before the component name.'. I put it like the following code in package.xml but it is not grabbing any custom link metadata in the custom object as is expected. Any comments would be highly appreciated.






I can't seem to find a good example of using the method that you're suggesting; normally, Weblinks are controlled through the CustomObject XML, as the following example (from the documentation):



<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="">

You deploy these custom links by deploying the relevant CustomObject:




<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="">

While it does specify that you can use an object-name.component-name syntax, I can't find a single example where it's used. In each case, it appears to be included as part of the metadata for the CustomObject. You should note that unless you have a destructiveChanges.xml file, you won't delete unreferenced WebLink entries by accident (i.e. if you have 5 custom links, and reference only one in the .object file, the remaining four are not automatically deleted when deploying).



You should probably just retrieve the CustomObject as a whole and re-deploy it.


Hi sfdcfox, Thanks for your comment. This indeed retrieves the <weblinks> metadata of the object but it also grabs all the information for this Object which is in the managed package. All I need is to persist the <weblinks> metadata of this object. The concept would be very similar to the <CustomField> element which just grab metadata of the newly added fields rather than the whole custom object in the managed package.

Instead of prefixing the managed packaged namespace with a dot, you will need to prefix it with a double-underscore:
It will work then.  
You can also delete these custom links and buttons this way as well, by putting that snippet in destructiveChanges.xml
Frans Flippo 14Frans Flippo 14
Note that metadata types are case sensitive.

I tried various variations of this with sfdx force:source:retrieve (which I'm assuming works the same as the Migration Tool when it comes to naming metadata) and found that WebLink needs to be spelled with a capital W and a capital L.

Hope this helps,