Importing Security Filters with a Dataport

jorgebragajorgebraga Member Posts: 25
Hi all of u!

I'm trying to import permissions from an Excel sheet using a Dataport.

The Permission Table (2000000005) is defined as follows

Field No. Field Name Data Type Length Description
1 Role ID Code 20
2 Role Name Text 30
3 Object Type Option
4 Object ID Integer
5 Object Name Text 249
6 Read Permission Option
7 Insert Permission Option
8 Modify Permission Option
9 Delete Permission Option
10 Execute Permission Option
11 Security Filter TableFilter

My poblem is precisely the Security Filter. I cannot use it in a Dataport.

The error states that the data type TableFilter is invalid for the Source expression.

How can we solve this problem?

Aditional info: NAV 3.70 SQL Server Dataport works fine if Security Filter is not used (BY I NEED IT BAD)

Txs in advance 4 your time

Answers

  • ara3nara3n Member Posts: 9,256
    have you tried to asign the value to a text variable and then export. And do the same when you import.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • krikikriki Member, Moderator Posts: 9,110
    If you don't use it, don't put it in the dataport.

    If you use it, you have to use a text-variable in the dataport and
    in the "OnBeforeExportRecord()" put
    txtSecurityFilter := FORMAT("Security Filter");
    

    and in the "OnBeforeImportRecord()" put
    txtSecurityFilter := '';
    

    and in the "OnAfterImportRecord()" put
    EVALUATE("Security Filter",txtSecurityFilter);
    IF "Role ID" = 'SUPER' THEN
      CurrDataport.SKIP; // this because I think it will give an error on the SUPER-role
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • jorgebragajorgebraga Member Posts: 25
    Guys txs a lot for your help.

    It works just fine (And it was very simple to do with your tips).
  • ara3nara3n Member Posts: 9,256
    Thanks kriki for writting to code. Don't have the time to write it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • krikikriki Member, Moderator Posts: 9,110
    Didn't take me that much time to write it.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,256
    that is still time :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • maya-chanmaya-chan Member Posts: 45
    I guess it's only work if u didn't put any filter on security filter.
    How bout if we put filter on it? I tried but can't work for imported the filtering.

    CMIIW
  • krikikriki Member, Moderator Posts: 9,110
    Does it give an error? And in that case: which error?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • maya-chanmaya-chan Member Posts: 45
    No error, but the security filter not inserted, only blank.
    But i have worked with it.
    I added Clear then it's worked
    Thx
Sign In or Register to comment.