Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
How can I put the owner name in a text field when the form is loaded?
You could achieve this by js code and here are the steps.
1.Develop js code to put the owner name to a text field.
2.Create a new webresource with the code. Open form editor and click on "Form properties".
3. Add the js function to form onload event.
4.Save and publish.
Then let's see the final result.
Hope it helps.
If the formtype is create, then you can get the owner name using the following code:
var userSettings = Xrm.Utility.getGlobalContext().userSettings; // userSettings is an object with user information.
var current_User_Id = userSettings.userId; // The user's unique id
Then you can use webapi to access user table to get the name of the user using the above user id
If formtype is update, then you can fetch the owner from ownerid field
var ownerIDname= Xrm.Page.getAttribute("ownerid").getValue().name;
If found useful, please mark this answer as verified.
Get the owner name -> var ownername = Xrm.Page.getAttribute("ownerid").getValue().name;
Set the owner name in your text field -> Xrm.Page.getAttribute("your_textfield").setValue(ownername);
Please mark as verified if the answer has helped you to resolve the issue!
WAVEour_textfield"). SetValue (ownername);
Business Applications communities