I am new to Model Driven Apps. I am trying to Set a field value with the current username when that user Selects Approve on a Choice Column. The research i have done says the only way to do that is to use JavaScript. This is what I have so far after using Copilot:
function GetCurrentUserOnChange(){ var dropdownValue = Xrm.Page.getAttribute("car_BryceCompanyApproval1").getValue(); if (dropdownValue === "Approve") { var currentUserName = Xrm.Utility.getGlobalContext().userSettings.userName; var message = currentUserName + "Date and Time"; Xrm.Page.getAttribute("car_BryceCompany_1_ApproveBy").setValue(message); } } Xrm.Page.data.entity.addOnLoad(hideSectionIfFieldEmpty);
I am not sure if this is the best way to do it. And i am not sure how to get it working with in my form.
Any help would be welcomed.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional