Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Field Service forum / Change Booking Status ...
Field Service forum

Change Booking Status synchronously with JavaScript using Javascript Bridge in Woodford

(0) ShareShare
ReportReport
Posted on by 25

Hi,

I'm using the MobileCRM.UI.EntityForm.onChange function within the Bookable Resource Booking  (Booking entity) in Woodford app for Dynamics CRM 365.

My objective is to change the booking status with JavaScript and save the booking immediately. But the two last lines of code in the If{...} aren't working (red lines). Any ideas? Thanks in advance!

    MobileCRM.UI.EntityForm.onChange(
        function (entityForm) {

            var changedItem = entityForm.context.changedItem;

            if (changedItem == "nds_endjob") {

                // Now get edited entity Bookable Resource Booking and set its booking status field to "Complete"
                var editedEntity = entityForm.entity;

               //The following two lines are just to make sure that I can get the Booking status Id.
                var bookid = entityForm.entity.properties.bookingstatus.id;
                alert(bookid);              

               // These are the lines that are not working: Setting the value to Completed and then Saving the Bookable Resource Booking right    away.
                editedEntity.properties.bookingstatus.Value = "Completed";
                editedEntity.save;
                
            }
        },
        true,
        null
    );

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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