Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Trying to make a link to go to a specific case survey

Posted on by Microsoft Employee

Hello, I am trying to fix case surveys that our companies used to send out, I am relatively new here and was not involved in the installation of the CRM. I managed to get it working but I am just lost on the formatting to get this hyperlink to display the current case.  

I just need to make it so it places the case ID at the end of the url see below.

https://www.ourwebsiteurl.com/survey/?caseid=(case pertaining to email)

I just want customers to have a Click here with that link where the link will automatically add the case id to the end of it.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Trying to make a link to go to a specific case survey

    Hi Kokulan

    The only thing that used to be where the links lied were these 2 variables in picture below, when the emails get sent nothing would be where the links were supposed to be. I am unsure what was here before or if these automated email url is supposed to interact with our web form some how. We use a javascript form I believe which is already set to work if you navigate to the url + the case ID. 

    automated-email-url.png

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Trying to make a link to go to a specific case survey

    Hi

    When this link is generated, is it by a workflow/plugin or Javascript?

    if its javascript, you can use the following line in your webresoruce to set the link

    var url = "https://www.ourwebsiteurl.com/survey/?caseid=" + formContext.data.entity.getId();

    [View:https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity/getid:750:50]

    if its workflow, you will have to create a custom workflow activity, something like the following

    namespace Microsoft.Crm.Sdk.Samples

    {

       public sealed class GenerateSurveyURL : CodeActivity

       {

           [Input("Case")]

           [ReferenceTarget("incident")]

           public InArgument<EntityReference> Case { get; set; }

           [Input("Source URL")]

           public InArgument<string> SourceURL { get; set; }

           [Output("Generated Url")]

           public OutArgument<string> GeneratedUrl { get; set; }

           protected override void Execute(CodeActivityContext executionContext)

           {

               IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

               IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

               IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

               EntityReference caseER = Case.Get(activityContext);

               string sourceUrl = SourceURL.Get(activityContext);

               GeneratedUrl.Set(sourceUrl.Replace("{}", caseER.Id));

           }

       }

    }

    This can then be called in a workflow to generate the URL. Please see the link below to read more about custom workflow activity(CWA)

    When you call this CWA in your workflow, you will have set the Case to Case input and for Source URL : https://www.ourwebsiteurl.com/survey/?caseid={}.

    [View:https://community.dynamics.com/365/f/761/t/234283:750:50]

    Hope this helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans