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

Notifications

Announcements

No record found.

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 445

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.

  • André Arnaud de Calavon Profile Picture
    283,862 Test role Public on at
    RE: Query extended range failure: FormControlFieldSelector.Basic is not a valid datasource.field pair near pos 44.

    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.

  • Suggested answer
    Huggins Mafigu Profile Picture
    445 on at
    RE: Query extended range failure: FormControlFieldSelector.Basic is not a valid datasource.field pair near pos 44.

    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.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    283,862 Test role Public on at
    RE: Query extended range failure: FormControlFieldSelector.Basic is not a valid datasource.field pair near pos 44.

    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

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

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

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

Product updates

Dynamics 365 release plans