Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Unanswered

Work Order ID to display in Description Field

Posted on by Microsoft Employee

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.

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

    Would a simple workflow work to populate the description field?

  • cloflyMao Profile Picture
    cloflyMao 25,198 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

  • Community Member Profile Picture
    Community Member Microsoft Employee 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
    cloflyMao 25,198 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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans