web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Cloning Case record

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You can write code to do that ;)

  • Community Member Profile Picture
    on at

    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
    84,331 Most Valuable Professional on at

    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
    on at

    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!

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    What is new_guid field and how is it populated?

  • Community Member Profile Picture
    on at

    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!

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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
    on at

    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.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Have you tried following:

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans