- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-24-2010 02:45 PM
We have a custom button in "Work Order Maintenance" called "Goto Complete". Basicly it just opens the "Completion Entry" window. What i'm trying to do is have it auto fill the "txtWorkOrderNo [SOTAMaskedEdit]" field with the WorkOrderNo from "Work Order Maintenance" window. Below is the code i'm using. Thanks!
Sub CommandButton1_Click
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run ("C:\Windows\system32\BusinessDesktopLoader.exe /T570753031 " + Form.Controls("txtWorkOrderNo").Text)
End Sub
Re: CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-25-2010 07:28 AM
Nobody has any ideas? The break... or were it seems to fail is after "WshShell.Run ("C:\Windows\system32\BusinessDesktopLoader.exe /T570753031 "" the "+ Form.Controls("txtWorkOrderNo").Text)" isn't sending text to the next screen. It's not erroring out. I put "msgbox Form.Controls("txtWorkOrderNo") at the end of the code and it returns the WorkorderNo in a message box.
There is around a 2 second delay between windows.. I think it's sending the Workorderno but there just isn't a window to put it in. I also tried puting a delay between the windows.. but still no go. I used "wscript.sleep (2000)" but it errors out saying it doesn't understand the command "wscript.sleep". This is what i've tried.
Sub CommandButton1_Click
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run ("C:\Windows\system32\BusinessDesktopLoader.exe /T570753031 " )
wscript.sleep (2000)
Form.Controls("txtWorkOrderNo").Text)
End Sub
Re: CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-25-2010 05:41 PM
I don't think you can just add the value like that. When we launch applications with context, we send the information in an XML string and call a drill around method. I don't know the exact signature of what we send, but I'll forward along the question to see if this is do-able.
Re: CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-28-2010 04:48 AM
Thanks dbcoles! I really hope it is do-able.
Re: CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-11-2010 09:27 AM
Sample to launch AR Customer Maintenance with specific customer context:
Private Declare Function AllowSetForegroundWindow Lib "user32" (ByVal dwProcessID As Long) As Boolean
Private Const ASFW_ANY = -1
Private Sub Command1_Click()
Dim bRetVal As Boolean
bRetVal = AllowSetForegroundWindow(ASFW_ANY)
Err.Clear
Dim CustID As String
CustID = Me.txtCustomerID.Text
Dim xml As String
xml = "<Environment><Context><CustID Value=""" & CustID & """ /></Context></Environment>"
Dim TaskID As Long
TaskID = 83952612
Dim NavigateTo As Object
Set NavigateTo = moClass.moFramework.LaunchTask(TaskID, EFW_TF_AUTOSHUTDN + EFW_TF_AUTOLOADUI + EFW_TF_AUTODISPLAYUI + EFW_TF_STANDALONE, 0, 0, 0, xml)
End Sub
Re: CommandBut ton1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-11-2010 09:48 AM
After looking at this specific issue here is the code you want:
In mfzdb001.frm:
Private Declare Function AllowSetForegroundWindow Lib "user32" (ByVal dwProcessID As Long) As Boolean
Private Const ASFW_ANY = -1
Private Sub Command1_Click()
Dim bRetVal As Boolean
bRetVal = AllowSetForegroundWindow(ASFW_ANY)
Err.Clear
Dim WorkOrder As String
WorkOrder = Me.txtWorkOrderNo.Text
Dim xml As String
xml = "<Environment><Context><WorkOrderNo Value=""" & WorkOrder & """ /></Context></Environment>"
Dim TaskID As Long
TaskID = 570753031
Dim NavigateTo As Object
Set NavigateTo = moClass.moFramework.LaunchTask(TaskID, EFW_TF_AUTOSHUTDN + EFW_TF_AUTOLOADUI + EFW_TF_AUTODISPLAYUI + EFW_TF_STANDALONE, 0, 0, 0, xml)
End Sub
In mfzdg001.cls:
Public Sub NavigateTo(ByVal xml As String)
On Error Resume Next
Dim sWorkOrderNo As String
sWorkOrderNo = Trim(GetFromXML(xml, "WorkOrderNo"))
If Len(sWorkOrderNo) > 0 Then
mfrmMain.txtWorkOrderNo.Text = sWorkOrderNo
mfrmMain.bIsValidID
End If
Err.Clear
End Sub


