Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
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 | 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