none
Working with the SDK from a SCSM form

    Question

  • I have a form in Service Manager. I perform somw operations using the SDK. I would like to know how to get the current open object and the current user object so that I can use then when creating relationships.

    Thanks

    Nick

    Tuesday, June 26, 2012 7:02 PM

Answers

  • Check my reply to your question for accessing the current item from an open form here:
    http://social.technet.microsoft.com/Forums/en-US/customization/thread/0c9ec62a-46a3-4bbd-88f6-21c2ddb1d210

    You can use "emg.GetUserName()" to get the current username and then search for it like any other EnterpriseManagementObject.

    To set a relationship using your emoUser and the current instance you can do this:

    EnterpriseManagementObjectDataType dataType = new EnterpriseManagementObjectDataType(mpcADUser);
    IDataItem iUser = dataType.CreateProxyInstance(emoAssignToUser);
    i[sAssignedTo] = iUser;
    "sAssignedTo" is the alias of the type projection relationship that you want to set.


    Rob Ford scsmnz.net


    Wednesday, June 27, 2012 7:35 PM
    Moderator