web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Query extended range failure: FormControlFieldSelector.Basic is not a valid datasource.field pair near pos 44.

(0) ShareShare
ReportReport
Posted on by 509

Good day people

I am struggling to get this right. I need to filter the query to exclude the two values in the datasource when viewing the form, but I'm getting the following errors.

Code:

[ExtensionOf(formDataSourceStr(FormControlFieldSelector, FormControlFieldSelector))]
final class FormControlFieldSelector_Extension
{
     
        public void init()
        {
                next init();
        QueryBuildDataSource qbds;

        qbds = this.query().dataSourceName(tableStr(FormControlFieldSelector));

        qbds.name('FormControlFieldSelector');

        qbds.addRange(fieldnum(FormControlFieldSelector, Field)).value(strFmt('((%1.%2 != %3) && (%1.%2 != %4))',
            qbds.name(),
            fieldStr(FormControlFieldSelector, Field),
            queryValue('Basic'),
            queryValue('Cost')
            ));
}
}

Results:

dasd.png

I appreciate your help.

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    302,505 Super User 2025 Season 2 on at

    Hi Huggins,

    I wonder about the business case here. It seems like you are extending a generic class where not all the forms will have a field called 'Basic' or 'Cost'. Probably on some other forms the 'Cost' field should be visible.

    If you need to restrict access to certain fields for particular users, you can set table and field permissions via security roles. For the fields which should not be visible, you can set 'deny' access to hide these fields for users. You can read about how to manage the field permissions on my blog with a certain example: Security how-to: Only finance users are allowed to see cost prices in Dynamics 365 Finance and Operations - Dynamicspedia

  • Suggested answer
    Huggins Mafigu Profile Picture
    509 on at

    Hi Andre Arnaud de Calavon ,

    Thank you for your quick reply. What I want here is to restrict access to those two fields on the FormControlFieldSelector form. 

    What made me to omit the option of using security roles is because this solution is to be applied to the System Administrator which is of course against the Security Architecture of D365FO. We want to restrict access on these fields to some users with system administrator role because of the sensitive nature of data in these fields.

  • André Arnaud de Calavon Profile Picture
    302,505 Super User 2025 Season 2 on at

    Hi Huggins,

    Is the system administrator the correct role for these users? They can still use the table browser functionality on the client to view data which is in the table. If other users have added these fields, the system administrators can copy the personalization form other users. There is also an option to change an exported personalization file and import it and add these two fields. Now, we only discuss two fields, but system administrators would be able to do a full procure to pay process which is a huge internal risk.

    The best option to secure data is by not providing system administrator roles. You can consider an own "super user" security role if they need a lot of access.

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 629 Super User 2025 Season 2

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 444 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 288 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans