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)

How do I get the ID of a newly-create Annotation record?

(0) ShareShare
ReportReport
Posted on by

I'm trying to create an attachment/annotation from a Word Template, and then copy it to a Sharepoint location.

I have managed to create the new Word document using the SetWordTemplate Action, but I don't know where I can get the Guid of the newly-created record.

Process.callActionFromHtml("SetWordTemplate",
[
{
key: "Target",
type: Process.Type.EntityReference,
value: new Process.EntityReference("test_entity", testEntityId)
},
{
key: "SelectedTemplate",
type: Process.Type.EntityReference,
value: new Process.EntityReference("documenttemplate", templateId)
}
],

onWordDocumentGenerated(params)

    );

However, I am not getting any output when the action is completed successfully.

How can I get the Guid of the record that has been created please?

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    Unfortunately this action doesn't provide a useful return value. Probably the best option is to immediately retrieve the ID of the most recently create note attached to the target, which you can do with a queryexpression or fetch

  • Verified answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    You will get GUID of note(annotation) on post create of plugin.

    You will also get same in workflow that is registered on create of annotation.

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi Steve,

    As suggested above, you will have to query the annotation(Notes) records associated with that particular test_entity record, order by modifiedon desc and then get the first one in the list. You could also include the filename in your query as a filter to make your query a bit more accurate and to exclude all other notes and only get the notes with the same file name. When you use SetWordTemplate action, it sets the template name as the file name.

    I have has a similar requirement recently to implement.  I created Workflow to use the SetWordTemplate to generated the document and then I created a Flow that triggers on Create of Note record in CRM and moves the document to SharePoint. This is a no code solution but if you are interested, let me know I can point you to sample flow blog posts.

    Update : Sorry my suggested solution about using flow is only for Online. I did not realize yours is onprem.

  • Community Member Profile Picture
    on at

    Hi David

    Thanks for your reply.

    I tried that. Unfortunately, because computers always speed up when you don't want them to, when I did the Retrieve it picked up the already-existing documents and didn't pick up the one I had just created. I thought that perhaps the Retrieve had executed too soon, so I tried to build in a Delay before doing the Retrieve, but that just created more complications.

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