Running different page versions based on company

dashenk23
Member Posts: 40
I'm trying to find a way in RTC to be able to run different versions of pages by company, for example a Sales Order or Customer Card...I can create the additional pages, but can't figure out a way to change which one runs depending on the company. Does anyone know of a solution for this? Thanks in advance for any help!
0
Comments
-
I've done somehting similar, a module that can be enabled or disabled, the modul replaces standard pages.
This code needs to be run on the OnOpen TriggerIF ISSERVICETIER THEN BEGIN IF NOT Job.GET("No.") THEN BaseVersion.RunHyperlinkRTC(0,3032014,3) ELSE BEGIN JobCard2.SETTABLEVIEW(Rec); JobCard2.SETRECORD(Rec); JobCard2.RUN; END; ERROR(''); END ELSE BEGIN JobCard2.SETTABLEVIEW(Rec); JobCard2.RUNMODAL; JobCard2.GETRECORD(Rec); CurrPage.CLOSE; END;
The Error(''); is needed because you can't run currpage.close on the OnOpen trigger (known issue, reported to MS, this is their workaround), it just closes the page.
RunHyperlinkRTC(): Is a function that runs a Hyperlink to open the Card in New-Mode, otherwise you can't use the standard "sparkle" new buttons
Here is the RunHyperlinkRTC Function:RunHyperlinkRTC(_ObjectType : 'Page,Report';_ObjectNo : Integer;_Mode : ' ,View,Edit,Create') // BASIS037 IF NOT ISSERVICETIER THEN ERROR('GetHyperlinkStringRTC() is only available on Service Tier'); GetServerAndServiceName(ServerTxt,PortTxt,ServiceTxt); CASE _ObjectType OF _ObjectType::Page : RunObjectTxt := STRSUBSTNO('runpage?page=%1',_ObjectNo); _ObjectType::Report : RunObjectTxt := STRSUBSTNO('runreport?report=%1',_ObjectNo); END; HyperlinkTxt += STRSUBSTNO('DynamicsNAV://%1:%2/%3/%4/%5',ServerTxt,PortTxt,ServiceTxt,Utility.URLEncode(COMPANYNAME),RunObjectTxt); IF _Mode <> _Mode::" " THEN HyperlinkTxt += STRSUBSTNO('&mode=%1',_Mode); ExecuteShell(HyperlinkTxt);
Name DataType Subtype Length
Utility Codeunit Online Map Utilities
And the last one:GetServerAndServiceName(VAR _ServerTxt : Text[30];VAR _PortTxt : Text[30];VAR _ServiceTxt : Text[30]) IF NOT ISSERVICETIER THEN ERROR('GetServerAndServiceName() is only available on Service Tier'); IF ISCLEAR(WSHNetwork) THEN CREATE(WSHNetwork); IF ISCLEAR(DomDoc) THEN CREATE(DomDoc); _ServerTxt := WSHNetwork.ComputerName(); DomDoc.load(APPLICATIONPATH + 'CustomSettings.config'); DomNode := DomDoc.selectSingleNode('//appSettings/add[@key=''ServerPort'']'); IF NOT ISCLEAR(DomNode) THEN _PortTxt := DomNode.attributes.item(1).text; // Server Port DomNode := DomDoc.selectSingleNode('//appSettings/add[@key=''ServerInstance'']'); IF NOT ISCLEAR(DomNode) THEN _ServiceTxt := DomNode.attributes.item(1).text; // Server Name CLEAR(DomDoc); CLEAR(WSHNetwork); IF (_ServerTxt = '') OR (_PortTxt = '') OR (_ServiceTxt = '') THEN ERROR('Error loading NST Config File');
Name DataType Subtype Length
DomDoc Automation 'Microsoft XML, v3.0'.DOMDocument
DomNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
WSHNetwork Automation 'Windows Script Host Object Model'.WshNetwork0 -
In some cases RTC is opening the correct page based on the properties on table. You cannot change this behavior in this way (or you need to change many thing to code instead using properties of buttons etc.)0
-
Hi Kine, that's exactly the reason for my solution. this way you only have to put code in the OnOpen Trigger of the original Page (in my example it was Job Card).
every time Job Card should be opened, my enhanced job card gets opened instead. Pages defined in Properties are supported too.0 -
WHat about cases where the page is lookup page and you need to return the result Action? Or you add some function and you are running the page through variable and you are using this function to return some data? Or you are strictly using it in the standard "way" of opening the lookup?0
-
Lookup works fine, you can use Getrecord to achieve that. Of course complex situations like returning values running modally etc, are not the idea of this. It's designed to use it the standard "just open the page with this record"-way.
For result action i guess that's not possible.
Functions could be implemented in the alternative Page as well and called after the Runmodal to give the result back to the original caller.
I don't say it's the best thing to do, or even recommend this [-X but i think most of the requirements can be done with this.
btw: 2009 R2 is required for the hyperlink function.0 -
Thanks for the details. It looks like good solution for given case... 8)0
-
ExecuteShell(HyperlinkTxt);
@deV.ch
Im using hyperlink(..) for this and sometimes it errors out for no reason. Would you mind sharing that function ExecuteShell() ?0 -
deV.ch wrote:ExecuteShell simply does this:
Name DataType Subtype Length
WSH Automation 'Windows Script Host Object Model'.WshShellIF ISCLEAR(WSH) THEN CREATE(WSH,TRUE,TRUE); WSH.Run(_Comand);
Thanks, has this too but it didn't start. Just revisited the code and noticed the create "run on client" parameter.. :oops:
How do you bypass the security warning from NAV?0 -
Sorry im talking about this message:
Microsoft Dynamics NAV Security Notice
You are about to connect to 'DynamicsNAV' on server 'vm004', which is not your current default connection setting.
This can create a security risk.
Do you want to continue?
Yes No
0 -
Does this help you?: http://www.mibuso.com/forum/viewtopic.php?t=39876
If you are working on your default instance (like it should be in a normal customer environment) you won't get this message.
Are you using a custom shortcut (for connecting to a specific instance) in you scenario?0 -
That was it. Im using a Virtual Machine as a server but didn't set it as default in the .config file.
Sorry for going off topic and thx.0 -
I had a similar requirement. What I did is, I added a Option field in the Company information. based on the selection the required page has to be opened.
And then from the Menusuite, I removed the page and added a codeunit, which checks for the company information and opens the page accordingly.
It was possible for me as I removed all the default menuitems from the menu and given limited options.--
Regards,
Raveendran.BS0
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
- 320 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