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 :
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
    );

I have the same question (0)

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 > Field Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans