Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Cloning Case record

Posted on by Microsoft Employee

How to store the guid of cloned record in the parent record so that we can use the guid to open the created case form?

*This post is locked for comments

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Cloning Case record

    Have you tried following:

    Xrm.Utility.openEntityForm("incident", guid, null, { openInNewWindow: false });

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cloning Case record

    Hello,

    Thanks for your response!

    I am able to clone the records but facing problem while opening created record in same window.  I am able to open newly created cloned record in new window but I want in same (can be in different tab). I have tried Xrm.Utility.openEntityForm("incident", guid) and Xrm.Navigation.openUrl(url) but it is getting into different window.

    Could you please suggest something how can I open record in same window.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Cloning Case record

    I would suggest to regroup. Based on your code all your cloning is happening inside workflow. You can do following - use action instead of workflow with output of Lookup, EntityReference type. In this way you can do both - cloning and obtaining of resulting record id. Good luck.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cloning Case record

    new_guid is the hidden field in the case form. I want it to be populated with the guid of the cloned record when the workflow is executed but I am not able to populate the field new_guid. If anyhow I am able to get new_guid, I can open the cloned record form.

    So the problem is how to retrieve new_guid.

    How can i get the record id in the look up field and what shall i populate from the workflow?

    https://community.dynamics.com/crm/f/117/p/236706/822028#822028

    Thanks!

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Cloning Case record

    What is new_guid field and how is it populated?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cloning Case record

    Hello Andrew,

    I am using the following code to clone the case record. While opening the cloned record, I need new guid. Can you please help me in that.

    function ShowAlert_CloneCase() {

       debugger;

       Alert.show("Do you want to clone this existing case?", "", [

    new Alert.Button("Clone", onAlertCloneButton), new Alert.Button("Cancel")

       ], "Info");

    }

    function HideAlert() {

       Alert.hide();

    }

    function onAlertCloneButton() {

       debugger;

       Process.callWorkflow("6B537EDB-E446-442F-89FE-E993D05271B9",

      Xrm.Page.data.entity.getId(),

      function success() {

          debugger;

          alert("Workflow executed successfully");

       try {

           var url = "";

           var guid = "";

           if (Xrm.Page.getAttribute("new_guid") != null && Xrm.Page.getAttribute("new_guid").getValue() != null) {

               url = Xrm.Page.getAttribute("new_guid").getValue();

               var preUrl = url.substr(0, url.length - 55);

               // Retrievinmg Guid - 184f3bc9-5d83-e811-81a1-0050568a58b2

               guid = preUrl.substr(66);

               Xrm.Page.getAttribute("new_waguid").setValue(guid);

               // opening the newly created record using the guid

               var windowOptions = { openInNewWindow: true }; Xrm.Utility.openEntityForm("incident", guid, null, windowOptions);

           }

       }

      },

       function () {

           debugger;

           alert("Error executing workflow");

       });

    }

    function onAlertCloseButtonClick(args) {

       Alert.hide();

    }

    Thanks!

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Cloning Case record

    Can you please post a code that should open record form? This is what you should use - msdn.microsoft.com/.../jj602956.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cloning Case record

    Hello Andrew,

    Thanks for the suggestion.

    I am trying to clone the case record using javascript on the click of button and open the created record form but I am not able to open the form. Could you please suggest any solution to that.

    Thanks!

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Cloning Case record

    Hello,

    You can write code to do that ;)

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans