web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

Work Order ID to display in Description Field

(0) ShareShare
ReportReport
Posted on by

Can someone help me here?

Work-order ID is a system generated field within field service module, and it will auto populate on a new form-load.

I need to populate the same WO ID in the description field too, how can I do this with JS.

Cheers.

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at
    RE: Work Order ID to display in Description Field

    Hi Sandy,

    You can populate description field with WO ID by following steps.

    Here are steps.

    1.write custom JavaScript code.

    function autoPopulateData(executionContext) {
        var workerID = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
        var att = Xrm.Page.getAttribute("new_description");
        att.setValue(workerID);
    }

    2. Add your JavaScript code in a Script web resource.

    6281.png

    3. Associate Script web resource to a form.

    21.png

    22.png

    23.png

    4. Test

    6521.png

    Regards,

    Clofly

  • Community Member Profile Picture
    on at
    RE: Work Order ID to display in Description Field

    Great!! Thank You Clofly.

    It seems your code is pulling GUID.

    My requirement is, an auto-populated field, named as Work Order ID, which need to be get & set in the description field in same form.

  • cloflyMao Profile Picture
    25,210 on at
    RE: Work Order ID to display in Description Field

    Hi Sandy,

    The following is modified sample code.

    function autoPopulateData(executionContext) {
        var workerID = Xrm.Page.getAttribute("msdyn_name").getValue();
        var att = Xrm.Page.getAttribute("new_description");
        att.setValue(workerID);
    }
    

    In my form, the Work Order Number field which name is "msdyn_name” is an auto-populated field.

    So you just replace "msdyn_name” in the code with the name of the Work Order ID in your environment, the description field will be populated with the same WO ID automantically When the form onload.

    8080.png

    Regards,

    Clofly

  • Thomas David Dayman Profile Picture
    11,323 on at
    RE: Work Order ID to display in Description Field

    Would a simple workflow work to populate the description field?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 67

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 24 Super User 2025 Season 2

#3
mk1329 Profile Picture

mk1329 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans