Item Card - Purchase Price

kwajahathydrokwajahathydro Member Posts: 88
edited 2015-06-25 in Navision Attain
Hi,

We are using Navision 2009 R2 and we have two companies created in our database. There is an new requirement like for users who are not having administrator role or Super Role in Navision, they must not be able to view the purchase price field in item card and in item list. This is in form 30 (item card) and form 31 (item list)

Also the same control has to be in place when the user goes into Order Confirmation and clicks on item no field, press f5 to see the list of items, here also the same control has to be applied like he must not be able to see the purchase price field

How do I put an control over this purchase price field. If I edit form 30 and 31 all the rest of the users will be effected but how to make certain users selection only.

I am not an programmer but if someone can help me by replying on where and what kind of change has to be done, i will try it out in test database first to see if i can do it or not

Purchase Price Field in item card and in item list needs to be controlled based on user names and company name as well

Regards
Khan

Comments

  • neilgfneilgf Member Posts: 148
    Khan

    Hi! Do you mean the cost related fields on the item card and list of the purchase price menu option off the list?

    Neil
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi Neil,

    In Navision when you visit item card, there are few tabs below like Item, Sales, Purchase, Help. Now from Purchases tab, when you click there are more menu's inside this and one menu is called as Prices. When you drill down into purchase price window here you can see if there are any purchase prices specified or not. The field that stores the info is called Direct Unit Cost.

    This Direct Unit Cost is pulled into our Navision on its item card and it has been called as Current Purchase Price. I want this field to be shown to few users only and not everyone in the company

    Hope the above explanation helps you

    Regards
    Khan
  • neilgfneilgf Member Posts: 148
    Khan

    Yes it does! So you are trying to hide a field on the item card and list from set users - or show to only a few users.
    Just name the control, add a bit of code OnAfterGetRecord and you are away.
    The control you need to name is your bespoke purchase price field. Go into the properties of the field and replace the Name property in the list with something memorable - I changed it to ShowLimited. Then view the OnAfterGetRecord section of the form and add code like:

    IF USERID='NF' THEN CurrForm.ShowLimited.VISIBLE(TRUE) ELSE CurrForm.ShowLimited.VISIBLE(FALSE);

    Depending on how many users you are including / excluding, a better solution would be to add a new field to UserSetUp table (SeePP in my example) and then change the code to be:

    CurrForm.ShowLimited.VISIBLE(FALSE);
    if T91L.GET(USERID) and (T91L.SeePP) then CurrForm.ShowLimited.VISIBLE(TRUE);

    Hope this helps.

    Neil
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi Neil,

    I think you got it right. I have quite a few users and the best is to have it controlled in user setup with boolean. Means a new field has to be shown in User Setup as Show Purchase Prices. If the user A, on this field has a check mark, means he is allowed to see the purchase price on item card and in item list.

    But need a bit more from you. can you clearly tell me in which code unit or on which table I need to write the code. A well explained example can really help me to do it. I can do it but I always try out in my test DB first so I am sure I wont make mistakes. I need well guided steps on which table to insert this code (item table or user setup table or etc)

    Hope with a proper step by step approach i can do it

    Thanks
    Khan
  • neilgfneilgf Member Posts: 148
    Khan

    Yes I am sure that would help no end but sorry I charge for those type of step by step instructions with supporting screen dumps - need to earn a living.
    So here is a cheap / free version:
    Table 91 - add a new fields boolean under an id of 50000 or whatever is available.
    Form 119 - add new field on table 91 to default form 119.
    Form 30 -
    Change the 'Name' property for the bespoke field you have called Purchase Price as suggested in my last reply.
    Save the form.
    Go into design again and select code view.
    Find OnAfterGetRecord and add code as suggested in my last reply.
    Form 31 -
    As per form 30. Exactly the same code.

    Enjoy.

    Neil
  • kwajahathydrokwajahathydro Member Posts: 88
    Neil,

    I did exactly as per your example and now i get error as you have specified unknown variable. ShowLimited
    Define the variable under Global C/AL Symbols

    Why! How to correct it

    Regards
    Khan
  • neilgfneilgf Member Posts: 148
    Khan

    Sounds like you have not assigned the 'Name' property for your bespoke field to ShowLimited and so Nav cannot understand any reference to ShowLimited.
    See link below for screen shots.

    http://www.dynamicsnavukhelp.co.uk/soci ... hot-links/

    Hope this works.
    Neil
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi Neil,

    thanks for your reply and also for the link. I shall try it out today and see how

    Regards
    Khan
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi Neil,

    Well I tried it like on the first option you gave me - that is to control it from the form itself. I tried from user setup but still i couldnt get it right. So on the item card form i added the code like this

    IF USERID='ALVIN' THEN CurrForm.ShowLimited.VISIBLE(TRUE) ELSE CurrForm.ShowLimited.VISIBLE(FALSE);

    When I logged into Nav with that user name it is fine as I dont see the purchase price on the item card but when I login with my name as Khan, I am also not seeing the price, which I dont want in that way. Which ever user I define only that user is not allowed to see the purchase price on item card.

    How do I modify this code now so that when i login i must see it and when user Alvin logins he is not suppose to see it

    Regards
    Khan
  • neilgfneilgf Member Posts: 148
    Khan

    Works fine on my local so it may be that it is not picking up the correct user id as per the code.
    Can you send me screen shots of the item card when logged in as both user ids please and of the code sitting in OnAfterGetRecord for the item card form? Please send to neil@fpconsult.co.uk.

    Neil
  • kwajahathydrokwajahathydro Member Posts: 88
    Hi Neil,

    sent you my reply on the mentioned mail id. if you dont see in your mail box check out in junk mail or in spam if for any reason my mail goes into these mail boxes

    Regards
    Khan
Sign In or Register to comment.