Filtering Activities Pagepart by logged in user

Hello,

I am trying to complete a development project but have been a bit stumped. None of my changes break it, but none meet the need. Essentially I have an activites page part that is based off of a cue table. This page shows the status within the sales/purchase cycle based on counting an option dropdown. The goal is to check to see wether the logged in user is a salesperson, and if so filter the cue results by their salesperson code. The cue draws from the Sales Header table so this shouldn’t be an issue.

My most recent attempt was on the form init to:

salesp.SETRANGE(salesp.Name,USERID);
IF USERID = salesp.Name THEN
salesheader.SETRANGE(salesheader.“Salesperson Code”,salesp.Code);

Thank you for any input you may have on this subject.

Instead of IF USERID = salesp.Name THEN

try

IF salesp.FINDFIRST THEN

Also, you’ll need to create a FlowFilter field in the cue table. You will then need to add this FlowFilter to each of the FlowFields (cues that are displayed on the page in this case) so that it can take the salesperson into account.

Take a look at page 9030, Account Manager Activities, in the OnOpenPage trigger to see how the base product uses filters to control the cue numbers.

Okay, saw what your tlaking about. So went in and updated my code a bit.

Form - OnOpenForm()
RESET;
IF NOT GET THEN
INSERT;

salesp.SETRANGE(salesp.Name,USERID);
IF salesp.FINDFIRST THEN BEGIN
cue.“Salesperson Filter” := salesp.Code;
END;

I also tried the set in the On Init location with no difference.

Also went in and fixed all my flowfields to take into account the flow filter.

You don’t set a filter with a :=, you do it with a SETFILTER. I’m pretty sure that’s how they do it in the object I referenced as well.

Sorry for the long reply, was out of the office for the weekend. So even though its a flowfield that you are setting the filter in you use setfilter? I went in and did that and will see if the changes work.