Options

Filtering data by username in Employee Portal

kdimitrovkdimitrov Member Posts: 6
edited 2009-07-01 in Navision e-Commerce
Hello to all,

we need to use Employee Portal Webparts for publishing data to customers and other partners, e. g. a customer should be able to see all his purchases or complaints and their state of processing.

Is there any way of setting a filter connected to the login name of this customer so that he can see only his own purchases and complaints ?

So far I did not find such a possibility in the configuration tools of the EP.

Many thanks to anyone who can give me solution for this task !!!!

Krassimir Dimitrov

Answers

  • Options
    krikikriki Member, Moderator Posts: 9,090
    [Topic moved from Navision forum to Navision e-Commerce forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    BlackBirdBlackBird Member Posts: 52
    Hi Krassimir,

    This is possible, with and without additional coding.

    With coding:
    I think there's an example of how to do this somewhere in this forum.
    You would have to modify cdu 6816 (EP Read Data) and add the userid to the DecodeXML.FilterRecordWithStandard- and DecodeXML.FilterRecord-functions.
    In these filterfunctions in cdu 6813 (EP Decode XML) you have to add the userid as parameter and add functions like this:

    IF TableNo =YourTableNumberHere THEN
    SupportFunctions.BuildFilterStringFilterString,FilterType::Const,'YourFilterFieldHere',UserId);

    Without coding:
    You can also create a seperate webpart for each customer and apply a default filter in the webpart. With 10 customers :mrgreen: this is the easiest solution.

    Hope this helps.

    Best regards,

    Hans
  • Options
    kdimitrovkdimitrov Member Posts: 6
    Thank you Hans!
    I have implemented a similar solution - I have extended the filter in codeunit 6815 functions GetStandGrpReqTypeFilterFields and GetStandGrpReqTypeFilterKeys with the user-id:
    EPGrpRTFilterKeys.SETFILTER("Group Code", '%1|%2', GroupCode, EmployeeUserID);
    I take the EmployeeUserID from a global variable in codeunit 6811 - I set it in function ProcessXMLDocument and then read it with a new function GetEmployeeUserID. For this purpose the codeunit must be SingleInstance in order to keep the value of the global variable.
    I save the UserID similarly to Group Code in the table 6832 - for this purpose I had to remove the value of the TAbleRelation property of the field 'Group Code'
  • Options
    jonnycjonnyc Member Posts: 8
    I want to ask you if there is any possibility to filter results by dates in EP.
    For example, i have a list of results from a table ordered by date and I want to display the results only for the actual month.
    Im trying to filter the results only for EP but with no success.
    I also try to adapt your solution to my case and still no success.
    Can anyone give me a hint?
  • Options
    BlackBirdBlackBird Member Posts: 52
    Hi,

    This is an example of how i use this sort of filters (i have added this code to codeunit 6813 in function FilterRecord):

    IF TableNo =YourTableNo THEN
    SupportFunctions.BuildFilterStringFilterString,FilterType::Filter,'YourDateField',STRSUBSTNO(Text001,TODAY));

    where Text001 is: '>=%1'

    In this example a filter "Enddate >= TODAY" is applied.

    In your case you should first calculate the first (01-01) and last date (31-01) of the current month. Then if you change the Text001 to "%1..%2", the code would look something like this:

    IF TableNo =YourTableNo THEN
    SupportFunctions.BuildFilterStringFilterString,FilterType::Filter,'YourDateField',STRSUBSTNO(Text001,Firstdate,Lastdate));

    Good luck.
  • Options
    daler40daler40 Member Posts: 3
    I have made the code changes that you suggested to CU 6813 and 6816 to filter the userid to the record. it works for Card webparts but on List webparts I get an error:

    Navision error (10500): A '=' is missing in TransferFormulaData. WHERE(Salesperson Code=CONST("MLS"),ORDER(Ascending) )

    The code I added to 6813 is:

    IF TableNo = 13 THEN
    SupportFunctions.BuildFilterString(FilterString,FilterType::Const,'Code',USERID);

    The code I added to 6816 is:

    DecodeXML.FilterRecordWithStandard(XMLDocInFilters,TableNo,GroupCode,RequestType,ListRecordRef,UserID);

    and:
    DecodeXML.FilterRecord(XMLDocLineFilters,TableNo,LineRecordRef,UserID);

    I also added the parameter to the the functions of useridin in the CU 6815.


    Any ideas would be greatly appreciated!!??

    On other thing I might add -

    I am trying to filter the Salesperson Userid to a Salesperson Card in EP. Then i am adding some reports to the SP EP Card. Then I am trying to filter the Contact List to the SP Card - this filter will not (at least I do not know how to get it to filter) pass from the SP card to the Contact List...

    So i was adding code to filter table 5050 to the Salesperson and then when the EP opens the Contact List form gives me the error I listed above... ](*,)
Sign In or Register to comment.