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
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
Hi Nadine,
Could the solution work for you?
Regards,
Clofly
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.
Both of two options are required to be checked:
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.
Regards,
Clofly
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156