Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Dynamics 365 signature in generated word-template

Posted on by Microsoft Employee

Dear CRM specialists,

When creating a signature on my phone i can now see it in Dynamics 365. After that i made a word-template to store a created signature directly in to the word-template. Now when i want to do that i get the error that it is impossible to store an image into the created word-template. 

Anyone know a solution?

This is what i have in the work order; 1157.crmm.png

Thanks,

Gido

*This post is locked for comments

  • Suggested answer
    antc Profile Picture
    antc 2,909 on at
    RE: Dynamics 365 signature in generated word-template

    Just in case someone is looking this will work for a plugin where the signature is loaded into notes.

    Register plugin on post create annotation.

    try
                {

                    Entity entity = (Entity)context.InputParameters["Target"];
                    if (entity.Attributes.Contains("objecttypecode") && (entity["objecttypecode"].ToString() == "account"))
                    {
                        // Create query of annotation(note) entity i.e. the signature
                        // Your signature should be allways sig.jpg or change the filename
                        // This is based on account entity
                        var query = new QueryExpression("annotation");
                        query.ColumnSet = new ColumnSet("filename", "documentbody", "objectid");
                        query.Criteria.AddCondition("filename", ConditionOperator.Equal, "sig.jpg");
                        
                        Entity account = new Entity("account");
                        // Retrieve the signature or image and save it to new field "new_signature" which will be inserted as picture into Word template
                        var entities = service.RetrieveMultiple(query).Entities;
                        foreach (var item in entities)
                        {
                            account["new_signature"] = item.Attributes["documentbody"];
                            EntityReference entRef = (EntityReference)item.Attributes["objectid"];
                            Guid newguid = entRef.Id;
                            account["accountid"] = newguid;
                            service.Update(account);

                        }
                    }
                }
                catch (Exception e)
                {
                    throw new InvalidPluginExecutionException(e.Message);
                }

  • Markus_Moser Profile Picture
    Markus_Moser 65 on at
    RE: Dynamics 365 signature in generated word-template

    Awesome guide, helped me a lot!

  • Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: Dynamics 365 signature in generated word-template

    I believe the poster of the question is the only one that can set this as verified :-) , thanks anyway!

    For your plugin, I suggest you create a new question in this forum to receive a quicker answer.

  • Tim Dailey Profile Picture
    Tim Dailey 440 on at
    RE: Dynamics 365 signature in generated word-template

    Yes, I got it to work, thank you!  I do need to find a way to automate it. I tried using a calculated field but since the first signature field is 'multiple lines of text' and the calculated field would be 'single line of text' I can't use that feature to TRIM the first characters.  I would like to figure out a way to use Business Rules or something within Dynamics to remove the string of text, but I think like you suggested, will need a plugin.  If anyone reading this can help with a quick plugin please let me know.   I also can't figure out how LogicApps can help.

    Your solution of removing the string of text is working though, how do I mark this as verified answer?

    Thank you

  • Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: Dynamics 365 signature in generated word-template

    Did it solve your problem?

  • Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: Dynamics 365 signature in generated word-template

    you mean, logicApps?

    Yes, I believe that that should work.

    (I am not a developer, so I cannot assist you with plugins. I would personally use Scribe for such a thing :) )

  • Tim Dailey Profile Picture
    Tim Dailey 440 on at
    RE: Dynamics 365 signature in generated word-template

    That's too bad, I just started a new one and it showed up right away, and I got it to work with your method.  How easy is it to make a plugin to remove the ' data:image/png;base64, ' ?  Can I build an app to do it?

  • Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: Dynamics 365 signature in generated word-template

    Start from scratch, yes.

    You cannot refresh your crm URL for the metadata in a saved template.

    (Or I did not find how to do so..)

  • Tim Dailey Profile Picture
    Tim Dailey 440 on at
    RE: Dynamics 365 signature in generated word-template

    Thank you Wouter, awesome instructions!  However I cannot find my signature field in the list of XML choices.  The schema name is "new_signature" but it's not showing up. Is there a way to sync Word so it will pull from CRM? I had a document template already built and am now trying to add signature, maybe I need to start from scratch and generate a new document?  Thank you

  • Suggested answer
    Wouter Madou Profile Picture
    Wouter Madou 3,392 on at
    RE: Dynamics 365 signature in generated word-template

    Upon request a quick short manual.

    My screen recorder is not working for some reason, so here are some snapshots that should explain it all:

    Create a custom field as multiple line and give it more than 16k characters. 

    Go to control tab and add the pen control for mobile.

    10311.4.jpg

    Create a word template and in the developer tab open xml mapping pane.

    Switch url to dynamics and find your custom field by schema-name (new_signature).

    Right mouse click > insert content control > picture

    102723.2.jpg

    Upload saved template.

    HERE IS THE TRICKY PART:


    To show the base64 string as picture, they added the following part: ' data:image/png;base64, ' 
    This will not work in your Word file, so you will have to create a second field and fill it with the value without that part. (Best via plugin.)
    For testing purposes, you can just delete that part in your field, however, the signature will no longer be shown on the mobile app for that record.

    (ps: this is when you use the default app, not when you use Resco.)

    8867.3.jpg

    Open the template for the record and it should show:

    10311.4.jpg

    Regards,

    Wouter

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