Working with the SDK from a SCSM form
-
Tuesday, June 26, 2012 7:02 PM
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
All Replies
-
Wednesday, June 27, 2012 7:35 PMModerator
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-21c2ddb1d210You 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
- Edited by Rob.FordMVP, Moderator Wednesday, June 27, 2012 7:36 PM
- Proposed As Answer by Rob.FordMVP, Moderator Sunday, July 08, 2012 7:03 PM
- Marked As Answer by nicholasdallas Tuesday, July 10, 2012 5:56 PM

