Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

How can I get the saved value from assets in work orders.

(0) ShareShare
ReportReport
Posted on by 186

I have made a new field in the assets form . for eg (Technician)

when creating an asset you will have to enter the name of that technician.

Now I have to auto generate show the name of that technician when selecting a asset on work Order.

Anyone?

  • Suggested answer
    RE: How can I get the saved value from assets in work orders.

    Hi,

    You could create an onChange event on your "Customer Asset" field with the following code:

    function onChange(executionContext){
    	var formContext = executionContext.getFormContext();
        formContext.getAttribute("new_technician").setValue(null);
    	var asset = formContext.getAttribute("msdyn_customerasset").getValue();
    	if(asset != null && asset.length > 0){
    		var assetID = asset[0].id;
    		Xrm.WebApi.retrieveRecord("msdyn_customerasset",assetID).then(
    			function success(result){
    			    // the below new_technician is the name of Technician in your Customer Asset entity
    				var technician = result['new_technician'];
    				
    				// this new_technician is the name of Technician in your Work Order entity
    				formContext.getAttribute("new_technician").setValue(technician);
    			},
    			function (error){
    				console.log(error.message);
    			}
    		)
    	}
    }

    Result:

    Select a Customer Asset, Steve is Technician name.

    pastedimage1635299936294v1.png

    Then Technician on the Work Order form would be generated automatically:

    pastedimage1635300071067v2.png

  • James_Oliver Profile Picture
    James_Oliver 186 on at
    RE: How can I get the saved value from assets in work orders.

    I have already done that.

    Now Whatever asset I am saving here. should reflect on Work order.

    if I am Selecting any asset on work order I have added a field there, now what I want is if I enter asset on work order Technician name should come automatically.

    Thanks

  • RE: How can I get the saved value from assets in work orders.

    Hi,

    Do you mean you want to show Technician filed on the drop down list of asset field?

    pastedimage1635237154746v1.png

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans