Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I copy the shortcuts from one GP user to another? 1

Status
Not open for further replies.

Alcar

Programmer
Sep 10, 2001
595
0
0
US
I had to recreate a couple of GP users in our current GP80 environment.
After copying the security via the Advanced Security I got called by the user saying that she has no shortcuts and cannot create them....

Is there a way I can copy the shortcuts from one profile to another?

Daren J. Lahey
Programmer Analyst
FAQ183-874 contains Suggestions for Getting Quick and Appropriate Answers to your questions.
 
Yes actually...

Though it uses SQL statements - I have used it successfully for several new users I have setup.

I actually made it into a VB.NET program. Two combo boxes cboTo and cboFrom are populated from SY01400 from the DYNAMICS database. The invisible VALUE of the comboboxes equaling the USERID field from that table. That is then used in the transfer button to select all from the source user and loop through and build the SQL statement to insert it for the new user.

*Note* RunSQL and RunISQL are two function I wrote to run my SQL statements. RunSQL for running SELECT statements and RunISQL for everything else.

Code:
    Private Sub cmdTransfer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTransfer.Click
        If cboTo.SelectedValue = cboFrom.SelectedValue Then
            MsgBox("Transfer source and destination cannot be the same.")
            Exit Sub
        End If
        Dim dtFrom As DataTable = RunSQL("SELECT * FROM SY01990 WHERE ScbOwnerID = '" & FixSQLText(cboFrom.SelectedValue) & "'")
        RunISql("DELETE FROM SY01990 WHERE ScbOwnerID = '" & FixSQLText(cboTo.SelectedValue) & "'")
        For Each dr As DataRow In dtFrom.Rows
            Dim iSQL As New System.Text.StringBuilder
            iSQL.Append("INSERT INTO SY01990 (ScbGroupType, ScbOwnerID, ScbNodeID, ScbParentNodeID, ScbShortcutType, ScbSubType, ScbDisplayName, ScbShortcutKey, ScbTargetStringOne, ScbTargetStringTwo, ScbTargetStringThree, ScbTargetLongOne, ScbTargetLongTwo, ScbTargetLongThree, ScbTargetLongFour, ScbTargetLongFive, ScbCompanyID) VALUES(")
            iSQL.Append(dr("ScbGroupType") & ", ")
            iSQL.Append("'" & FixSQLText(cboTo.SelectedValue) & "', ")
            iSQL.Append(dr("ScbNodeID") & ", ")
            iSQL.Append(dr("ScbParentNodeID") & ", ")
            iSQL.Append(dr("ScbShortcutType") & ", ")
            iSQL.Append(dr("ScbSubType") & ", ")
            iSQL.Append("'" & FixSQLText(dr("ScbDisplayName")) & "', ")
            iSQL.Append(dr("ScbShortcutKey") & ", ")
            iSQL.Append("'" & FixSQLText(dr("ScbTargetStringOne")) & "', ")
            iSQL.Append("'" & FixSQLText(dr("ScbTargetStringTwo")) & "', ")
            iSQL.Append("'" & FixSQLText(dr("ScbTargetStringThree")) & "', ")
            iSQL.Append(dr("ScbTargetLongOne") & ", ")
            iSQL.Append(dr("ScbTargetLongTwo") & ", ")
            iSQL.Append(dr("ScbTargetLongThree") & ", ")
            iSQL.Append(dr("ScbTargetLongFour") & ", ")
            iSQL.Append(dr("ScbTargetLongFive") & ", ")
            iSQL.Append(dr("ScbCompanyID") & ")")
            RunISql(iSQL.ToString)
        Next
        MsgBox("Shortcut transfer completed (" & Trim(cboFrom.SelectedValue) & " -> " & Trim(cboTo.SelectedValue) & ").")
    End Sub

Hope that helps you out.
 
Thank you Borvik.. that worked for me

Daren J. Lahey
Programmer Analyst
FAQ183-874 contains Suggestions for Getting Quick and Appropriate Answers to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top