In Dynamics 365, the traditional way of sharing records involves manually managing user and team permissions. But what if you could simply generate a secure link and share it, so that anyone who clicks on it instantly gets access to the record?
Sounds interesting, right?
Microsoft’s GenerateSharedLink Action solves this problem by allowing users to create a secure, shareable link to a record with just one click. Instead of assigning permissions to each individual or team, you generate a link, share it with colleagues, and they gain access instantly.
This blog will walk you through:
- What shared record links are in Dynamics 365 CRM?
- Why are they better than manual permission management?
- A step-by-step implementation guides
- Security aspects of shared links
- Real-life use cases for CRM collaboration
What Is Shared Record Links in Dynamics 365 CRM?
Shared record links are unique, system-generated URLs produced through the GenerateSharedLink Action, designed for quick and secure record sharing. When someone clicks the link, Dynamics 365 automatically grants them the necessary permissions to access the record.
This makes collaboration:
- Faster → No waiting for manual permissions
- Flexible → Anyone with CRM access and the link can collaborate
- Secure → Each shared link carries a cryptographic key that ensures it is valid and hasn’t been altered
Why Use GenerateSharedLink Instead of GrantAccessRequest?
Traditionally, developers used the GrantAccessRequest message to share records programmatically. This required:
- Knowing who needs access in advance
- Assigning explicit rights (Read, Write, Append, etc.)
The GenerateSharedLink Action is simpler:
- Requires only the target record and access rights
- Generates a secure, shareable link instantly
- Allows users to collaborate without predefining every participant
Step-by-Step Guide to Creating Shared Record Links:
Step 1: Create a C# Assembly to Generate the Link
You’ll need a function that uses GenerateSharedLinkRequest and returns the link.
private void GenerateLinkOfRecord(CodeActivityContext context, IWorkflowContext workflowContext, IOrganizationService orgService, string primaryEntityName, string recordId, ITracingService trace) { #region function level variables string functionName = "GenerateLinkOfRecord"; EntityReference targetRecordReference = new EntityReference(); string recordLink=string.Empty; #endregion try { trace.Trace("Initiated GenerateLinkOfRecord"); targetRecordReference = new EntityReference(primaryEntityName,new Guid(recordId)); trace.Trace("Initiated GenerateLinkOfRecord"); GenerateSharedLinkRequest request = new GenerateSharedLinkRequest { Target = targetRecordReference, SharedRights = AccessRights.ReadAccess | AccessRights.WriteAccess }; trace.Trace("Initiated GenerateLinkOfRecord"); GenerateSharedLinkResponse response = (GenerateSharedLinkResponse)orgService.Execute(request); trace.Trace("Initiated GenerateLinkOfRecord"); recordLink =response.Response; trace.Trace("Initiated GenerateLinkOfRecord"); LinkString.Set(context, recordLink); } catch (InvalidPluginExecutionException ex) { throw new InvalidPluginExecutionException(functionName + ":" + ex.Message); } catch (FaultException<OrganizationServiceFault> ex) { throw new InvalidPluginExecutionException(functionName + ":" + ex.Message); } catch (Exception ex) { throw new InvalidPluginExecutionException(functionName + ":" + ex.Message); } }
Step 2: Register the Assembly in a Custom Action:
Expose the assembly logic through Dataverse by registering a custom action.
Step 3: Write JavaScript to Call the Action:
Use JavaScript with Xrm.WebApi.execute to generate the link dynamically when needed.
public generateLink(primaryEntityName: string, currentRecordId: string) { let functionName: string = "generateLink"; try { //validate name if (this.isValid(currentRecordId) && this.isValid(primaryEntityName)) { var request = { // Parameters Edm.String RecordId: currentRecordId.replace("{", "").replace("}", ""), PrimaryEntityName: primaryEntityName, getMetadata: function () { return { boundParameter: null, parameterTypes: { RecordId:{typeName:"Edm.String",structuralProperty:1 }, PrimaryEntityName: { typeName: "Edm.String", structuralProperty: 1 } }, operationType: 0, operationName: "new_GenerateSharedLink" }; } }; //@ts-ignore Xrm.WebApi.execute(request).then( function success(response) { if (response.ok) { return response.json(); } } ).then(function (responseBody) { var result = responseBody; console.log(result); var recordlink = result["RecordLink"]; CRM_Contact_Library.makeFullUrlFromResponse(recordlink); }).catch(function (error) { console.log(error.message); }); } } catch (error) { //showing the error CRM_Contact_Library.showErrorMessage(functionName, error.message); } } makeFullUrlFromResponse = (recordlink: string) => { //function level varibales let functionName: string = "makeFullUrlFromResponse"; try { //@ts-ignore var baseUrl = Xrm.Utility.getGlobalContext().getClientUrl(); // Construct full share link var fullRecordLink = baseUrl + "/main.aspx?" + recordlink; //@ts-ignore Xrm.Navigation.openAlertDialog({ text: "Shareable Link:\n" + fullRecordLink }); } catch (error) { CRM_Contact_Library.showErrorMessage(functionName, error.message); } }
Step 4: Add a Ribbon Button for Easy Access:
Provide end users with a simple “Generate Link” button on the ribbon so they can share records instantly.
Security of Shared Record Links in Dynamics 365:
The link created by the GenerateSharedLink Action contains two main parts:
- shareLink → Encodes the record information to uniquely identify the record being shared.
- sig (signature) → A unique cryptographic code that validates the integrity of the link and ensures it remains trustworthy.
When a user clicks the link, Dynamics 365/Dataverse validates the signature and grants access to the record. This ensures that only links generated through the system are trusted, making the sharing process both secure and reliable.
If either value is changed, the link becomes invalid. Before granting access, Dynamics 365 verifies the signature to confirm the link’s authenticity and maintain security.
The link we receive from the request is only a partial link. To make it usable, we build the complete URL in our ribbon script by combining the link with the required base path. This ensures the final URL is valid and allows the user to navigate directly to Dynamics CRM and access the shared record.
Use Case Example of Shared Record Links in Dynamics 365:
- Imagine a scenario where there is a Contact record named Kevin Martin in Dynamics 365. Courtney Larabee is the owner of this record, and her colleague Brad needs to collaborate on it. However, Brad currently does not have access.
- Brad doesn’t have access to the record.
- Courtney clicks the “Generate Link” button, gets a URL, and sends it to Brad.
- When Brad clicks the link, he is redirected to Dynamics CRM. Once there, navigating to the Contacts, he can view the shared record.
Key Takeaways:
- Shared record links simplify CRM collaboration by removing manual permission steps.
- The GenerateSharedLink Action in Dynamics 365 CRM provides secure, shareable URLs.
- Teams save time, reduce dependency on admins, and boost productivity.
FAQs related to Shared Record Links in Dynamics 365
- What is the GenerateSharedLink Action in Dynamics 365 CRM?
It’s a feature that creates a secure, shareable link to a CRM record, giving colleagues instant access without manual permission assignments. - Are shared record links secure?
Yes. Each link has a unique cryptographic signature. If altered, the link becomes invalid. - Can I use shared record links outside my organization?
No. Links only work within your Dynamics 365 CRM environment and require authentication. - What’s the difference between GenerateSharedLink and GrantAccessRequest?
- GrantAccessRequest → Requires specifying users and rights manually.
- GenerateSharedLink → Instantly creates a secure URL, no predefined user list needed.
- How do shared record links help sales and service teams?
They allow faster collaboration, ensure records are never locked due to unavailable users, and improve customer response times.
Conclusion
The GenerateSharedLink Action in Dynamics 365 CRM transforms record sharing. By replacing manual permissions with secure, one-click shareable links, businesses gain:
- Faster collaboration
- Reduced delays in decision-making
- Improved productivity and customer service
If your team still struggles with manual record sharing in Dynamics 365 CRM, it’s time to start using shared record links.