Coding OnAfterGetGetrecord trigger disables customercreation

chandrurecchandrurec Member Posts: 560
Hi all,

I have written the following coding in Form OnAfterGetRecord trigger to show only the location thats corresponds to the respective Location tagges for that user retail user setup.


recRetailUser.RESET;
IF recRetailUser.GET(USERID) THEN
IF NOT recRetailUser."POS Super User" THEN
BEGIN
IF recRetailUser."Location Code" <> '' THEN
BEGIN
IF "Location Code" <> '' THEN
BEGIN
FILTERGROUP(2);
SETFILTER("Location Code",'%1',recRetailUser."Location Code");
FILTERGROUP(0);
END;
end;
END
ELSE
RESET;

But when I create a new customer, the customer is not getting created .

If anyone knows whats the preoblem in code , Kindly give me the modified code or let me know the solution to make it work.

Thanks in advance.

Regards,
chandru.

Comments

  • vijay_gvijay_g Member Posts: 884
    chandrurec wrote:
    to show only the location thats corresponds to the respective Location tagges for that user retail user setup.
    why you written this code to onafterget trigger of customer card?
    do you want to lookup only location(set for particular user in retail setup)while creating new customer?
  • chandrurecchandrurec Member Posts: 560
    Hi Vijay_g,

    I want to see only the customers belonging to the location tagges in retail user setup. For this purpose only, I am writing the code in OnAfterGetRecord trigger of the form.

    Regards,
    chandru.
  • vijay_gvijay_g Member Posts: 884
    then write your code to onopen trigger.
  • chandrurecchandrurec Member Posts: 560
    Hi Vijay_g,

    When I write the coding in OnOpen trigger, its not working when I scroll through the records.

    Regards,
    chandru.
  • vijay_gvijay_g Member Posts: 884
    Try it...
    recRetailUser.RESET;
    IF recRetailUser.GET(USERID) THEN
        IF NOT recRetailUser."POS Super User" THEN  
            IF recRetailUser."Location Code" <> '' THEN
                BEGIN
                   FILTERGROUP(2);
                   SETFILTER("Location Code",'%1',recRetailUser."Location Code");
                   FILTERGROUP(0);
                END;
    
  • chandrurecchandrurec Member Posts: 560
    Hi Vijay_g,

    I tried the coding sent by you but still the same error persists.Filtering is happening but when I try to create a new customer , I cannot create it which is what I mentioned in the first post.

    Thanks & Regards,
    chandru
Sign In or Register to comment.