Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

From address from name default

Posted on by Microsoft Employee

Hello,

When creating a marketing email the from name and from address is the name of the user who created the email. Is it possible to change the default individually per Business Unit? I see a  risk that at some point we will forget to change the from name and address .... and send out an email in our name to all customers. 

Best, 

Nadine

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: From address from name default

    Hi, Thanks a lot! But unfortunately I am no Java script expert :/ Isnt there a real clean solution from Microsoft somewhere and maybe I have no idea that it exists :)? But I will ask some developers, maybe they can have a look and implement it for us :) Thanks a lot anyway!

    Best, Nadine

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: From address from name default

    Hi Nadine,

    Could the solution work for you?

    Regards,

    Clofly

  • Suggested answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: From address from name default

    Hi Nadine,

    You could run a custom JavaScript function at OnLoad event of marketing email form to populate "from name" with business unit name of current user, and "from address" with a concatenated email address with bu name.

    function autoPopulate(executionContext) {
    
      var formContext = executionContext.getFormContext();  
    
      var globalContext = Xrm.Utility.getGlobalContext();
    
      var currentUserID = globalContext.userSettings.userId.replace(/\{|\}/gi, "").toLowerCase();
    
      Xrm.WebApi.retrieveMultipleRecords("systemuser", "?$select=fullname&$expand=businessunitid($select=name)&$filter=systemuserid eq '"   currentUserID   "' ").then(
        function success(result) {
          for (var i = 0; i < result.entities.length; i  ) {
            var businessUnitName = result.entities[i].businessunitid.name;
            formContext.getAttribute("msdyncrm_fromname").setValue(businessUnitName);
            var originalFromAddress = formContext.getAttribute("msdyncrm_fromemail").getValue();
            var domain = originalFromAddress.substring(originalFromAddress.indexOf("@")   1, originalFromAddress.length);
            formContext.getAttribute("msdyncrm_fromemail").setValue(businessUnitName   "@"   domain);
          }
        },
        function (error) {
          console.log(error.message);
        }
      );
    
    }
    
    

    Steps to add the custom function:

    1. Top right gear icon > advanced settings > customizations > customize the system

    2. Entities > Marketing email > Forms > Designer

    3. Form properties: add custom JavaScript library > enable the custom function at OnLoad event of form.

    pastedimage1600937952444v1.png

    Both of two options are required to be checked:

    pastedimage1600938071505v2.png

    4. Save and publish the form.

    Result:(I changed the real business unit name to sample name.)

    The From name will be set to business unit name of current user.

    The From address will be set to a concatenated email address with bu name and the original domain.

    pastedimage1600938168033v3.png

    Regards,

    Clofly

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans