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

Announcements

News and Announcements icon
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 511

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
    305,624 Super User 2026 Season 1 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
    511 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
    305,624 Super User 2026 Season 1 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 658 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 632 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 570

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans