Created New Field in Sales Header Table and Sales Order Form
 
            
                
                    kwajahathydro                
                
                    Member Posts: 88                
            
                        
            
                    Hi,
We are using Nav 2009 SP 1 and we have two companies in our database. Company A & Company B, I have created a new field under Sales Header Table and Sales Order Form, I have inserted that new field but this new field also shown in the sales order form when I open Company A, I dont want this new field to be shown in Company A, how do I write a peice of code to hide it from Company A, Pls give me some steps as under code of sales header table or sales order form, which is the place or section that I need write a small line code to hide it from Company A.
Regards
KH
                We are using Nav 2009 SP 1 and we have two companies in our database. Company A & Company B, I have created a new field under Sales Header Table and Sales Order Form, I have inserted that new field but this new field also shown in the sales order form when I open Company A, I dont want this new field to be shown in Company A, how do I write a peice of code to hide it from Company A, Pls give me some steps as under code of sales header table or sales order form, which is the place or section that I need write a small line code to hide it from Company A.
Regards
KH
0                
            Comments
- 
            In OnOpenForm trigger, tryCurrForm."<Your Field>".VISIBLE := COMPANYNAME = 'Company B'; 0
- 
            Of course, instead using hardcoded name of the company, add some new option e.g. into Company Info table and make the decision based on this. Or add some option "Show field xxx" into Sales Setup and make the condition use this. Hardcoded constants in code are bad solution...0
- 
            Hi Mohana,
 When I use your code on the sales order form under the option specified by you, I put the code and then when try to save it gives error as i have defined an unknown variable, so how do i get it correct.
 Regards
 KH0
- 
            Can you show the code and where did you write?0
- 
            Hi Mohana,
 see the code how i have written
 I go to Object Designer/Form/42, Design, Press F9, and look at the trigger mentioned by you
 Form - OnOpenForm()
 CurrForm."Change Requested Del Date".VISIBLE := COMPANYNAME = 'Interior Affairs Group Pte Ltd';
 Is this above line written by me is correct or not, but when I compile the object, it gives me error an unknown variable
 Regards
 KH0
- 
            Is your field name correct..please check once...
 where is the pointer shows after pressing ok on Error?0
- 
            Hi Mohana,
 sorry! The field name was not right, so after reading your reply, I did checked the field and realized that it has a dot (symbol) in between so I did exactly the same and then complied the form, no error! see the code that i have written
 CurrForm."Change Requsted Del. Date".VISIBLE := COMPANYNAME = 'Interior Affairs Group Pte Ltd';
 Perfect! Many thanks for your kind help.
 Regards
 KH0
- 
            Please conside Kine's suggestion also..
 Hard coding is bad solution #-o0
- 
            Hi Mohana,
 I am a functional consultant who has no clue of coding. Before I ask for help and get help on this forum, I put it to my local system and check it throughly and only after that I shall apply the same to the live server. So considering other options is not within my scope, I can give the requirement to the vendor but he will simply charge me half a man day to do this, so its better for me to get some advise and do it for my customer. With coding or without coding, I am ok as long as it works for me. Thanks for your advise and at same time also on the code help
 Regards
 KH0
- 
            
 But....is it better for your client ? It works, true...FOR NOW ! Next time they add another company, the new field will show up there too, and the code has to be changed again. Working code is NOT the same as good code.kwajahathydro wrote:Hi Mohana,
 ...so its better for me...
 ...With coding or without coding, I am ok as long as it works for me...
 KH0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions


