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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Multi-select field is not retrieved in Mobile-Offline mode

(0) ShareShare
ReportReport
Posted on by 15

Hi,

I have a form of an entity (Daily Report) in which I added a javascript webresource on the OnChange property of a date field, this webresouce function is to check if the selected date is a weekend or not, and if it is a weekend it will popup an error about it. the weekend setting is configured on another entity (Configuration) as a multi-select option set.

Both entities/tables are enabled for Mobile Offline and included in the Mobile-Offline profile.

in the webresource I am using the (Xrm.WebApi.retrieveMultipleRecords) to get the record that contains the weekend setting and here is the full code:

 

function CheckWeekend(executionContext) {
    'use strict';
    var formContext = executionContext.getFormContext();
    var reportDate = formContext.getAttribute('drm1_reportdate').getValue();


    if (!!reportDate) {
        var d = new Date(reportDate);
        var DayNum = d.getDay();
        var Weekends = [
            { Num: 4, Value: 684100000 },
            { Num: 5, Value: 684100001 },
            { Num: 6, Value: 684100002 },
            { Num: 0, Value: 684100003 }
        ];
        var SelectedDayRecord = Weekends.find(elem => elem.Num === DayNum);


        if (!!SelectedDayRecord) {
            var SelectedDayValue = SelectedDayRecord.Value;

            Xrm.WebApi.retrieveMultipleRecords('drm1_configuration', "?$select=drm1_name,drm1_weekend&$orderby=createdon&$top=1").then(//
                function success(result) {
                    // perform operations on on retrieved records
                    var record = result.entities[0];
                    var weekendstng = record.drm1_weekend;
                    if (weekendstng.includes(SelectedDayValue)) {
                        var ErrorWeekendReport = Xrm.Utility.getResourceString('drm1_DialogLocalizations', 'ErrorWeekendReport');
                        var errorOptions = {
                            details: 'The selected date is a Weekend day, please select another date!',
                            errorCode: 404,
                            message: ErrorWeekendReport,
                        };

                        Xrm.Navigation.openErrorDialog(errorOptions).then(
                            function () {
                                // perform operations on error dialog close
                                formContext.getAttribute('drm1_reportdate').setValue(null);
                            }
                        );
                    }

                },
                function (error) {
                    alert(error.message);

                }
            );
        }
    }

}

the problem that when I go in offline mode the Xrm.WebApi.retrieveMultipleRecords does not recognize the (drm1_weekend) field because it is a multi select field type, so is this a known limitation? or is it a bug?

is there any workaround this issue?

 

thanks,

Mohammad

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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans