Skip to main content

Notifications

Announcements

No record found.

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

Access subgrid for WO service tasks with JS in Mobile App

(0) ShareShare
ReportReport
Posted on by 2,909

I need to check that all WorkOrder Service Tasks are complete prior to a Booking be closed in the Field Service Mobile App

I already get one attribute from the Service Tab and set a field required based on some logic which works well

var faultcategory = formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("eye_faultcategory").getValue();

however I can't get the gridContext as below it always returns null

var formContext = executionContext.getFormContext();
var gridContext = formContext.getControl("workorderservicetasksgrid");

This is OnSave as well so I don't believe it's due to not being loaded.

Also confirming this is the Bookable Resource Booking form that integrates the WorkOrder form as well.

Any better ideas I was planning to get rows and check all completed.

  • antc Profile Picture
    antc 2,909 on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Thanks Gabriel I had forgotten that retrieve was supported will mark as answered and will also update as MS support are having a look at the grid access as well if we can work out how to access.

  • Verified answer
    Gabriel Dias Junckes Profile Picture
    Gabriel Dias Junckes 2,435 on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Hi Antony.

    You can retrieve the records when offline, assuming all the records you need are synchronized.

    docs.microsoft.com/.../offline

    Regarding the tab access, I am unsure about getting the object.

  • antc Profile Picture
    antc 2,909 on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Hi Gabriel

    The App works in offline mode so don't know if I can do a retrieve.

    As mentioned I can access a column on the same form tab and it's MS OOB subgrid so should be supported.

  • Suggested answer
    Gabriel Dias Junckes Profile Picture
    Gabriel Dias Junckes 2,435 on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Hi Antony.

    The mobile phone uses a Custom Component so you may not have access to all the attributes.

    It will also have more chances to break if the subgrid or view gets updated.

    How about you do a retrieve to return those records on the saving button? You could also check if there is another open booking (e.g. the technician scheduled another follow-up).

  • antc Profile Picture
    antc 2,909 on at
    Access subgrid with javascript in Mobile App form

    Asked this question in Field Service Forum however not really FS specific

    I need to check that all WorkOrder Service Tasks are complete prior to a Booking be closed in the Field Service Mobile App

    I already get one attribute from the Service Tab and set a field required based on some logic which works well

    var faultcategory = formContext.ui.tabs.get('fstab_service').sections.get('fstab_service_section_general').controls.get('msdyn_workorder2').getAttribute("eye_faultcategory").getValue();

    however I can't get the gridContext as below it always returns null

    var formContext = executionContext.getFormContext();
    var gridContext = formContext.getControl("workorderservicetasksgrid");

    This is OnSave as well so I don't believe it's null due to not being loaded.

    Also confirming this is the Bookable Resource Booking form that integrates the WorkOrder form as well.

    Any better ideas I was planning to get rows and check all completed.

  • antc Profile Picture
    antc 2,909 on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Hi Leah

    Thanks for the link.

    My problem is I am getting null returned. I have tried to find it using the debugger without success. I suspect this code would work on a normal form however the nature of the bookable resource Booking form is causing me issues.

    Regards

    Antony

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access subgrid for WO service tasks with JS in Mobile App

    Hi antc,

    You can refer the following link:

    Get row data from the Sub-Grids in Dynamics 365 - CRM Crate 

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans