
Announcements
I have a file column in my dataverse table. I have uploaded a file to my record and want to open the file from a link in a PCF that I am developing that resides on a custom page. When I retrieve the record's file value it provides a Value like :
appres://datasources/Results/table/slp_result/rows/5a3a6d68-2e9e-ec11-b400-000d3a5d31c5/fileimageurl/http:%2F%2Ftemp.url/column/slp_file/resourceid/bf6ac4b6-d2a2-ec11-983f-0022480b18d9
I am using a Link fluentUI tag that requires an href, I cannot figure out how to parse the correct href so that user can open this file. It seems like the href should look something like:
https://[my url].crm.dynamics.com/api/data/v9.0/slp_results(5a3a6d68-2e9e-ec11-b400-000d3a5d31c5)/slp_file/$value
How do I reference my root url dynamically from inside the PCF code? When I use window.location.href, I get something like this:
about:blank?PowerAppsLanguage=en-US#%7B%22hideNavBar%22%3Atrue%2C%22antiCSRFToken%22%3A%22a7b90131-0757-4f64-b6b9-2b2f29ac00c3%22%2C%22paramsQuery%22%3A%22recordId%3Db63ea9b5-7a5e-ec11-8f8f-00224829f2c8%26id%3Db63ea9b5-7a5e-ec11-8f8f-00224829f2c8%26entityName%3Dslp_test%26etn%3Dslp_test%26canNavigateBack%3Dtrue%22%7D
Is there a property in the PCF context that could provide the root url?
<Link href={href} underline>
{file.fileName}
</Link>
There is a property in the PCF context from a custom page. It is not typed but you can use:
// -ignore
console.log({ contextxrm: this.context.page.getClientUrl() });