How to Get the created Request Activity Status using SCSM 2012 SDK

Hi, i have created a ServiceRequest,
so there are Activities related to Servicerequest.
I am trying to know the Status of the each Activity (Completed,Failed etc)
and the Change of Activity (like from ReviewActivity to RunBookActivity).
how can we get the Activity status change programmatically.
so that i could Display this Status to other Portal, 
I am Creating a CustomActivity with ActivityID as Parameter to Workflow inheriting WorkflowActivityBase
protected
override
ActivityExecutionStatus Execute(ActivityExecutionContext
executionContext)
Is this a Right Approach..???
Plz respond as m not getting the way ..

I'm not entirely clear on what you're trying to accomplish, but I can give you some guidance on getting the status of activities that are part of a service request.
Quick overview before we get to the code: After we connect to the database we want to retrieve some management packs, a relationship, and a type projection. We then want to create some criteria for querying the Service Manager database. Then we execute the
query and traverse the results, displaying the activity ID and it's status.
//Connect to Service Manager
EnterpriseManagementGroup emg = new EnterpriseManagementGroup("<your management server>");
//Get some management packs
ManagementPack mpSystem = emg.ManagementPacks.GetManagementPack(SystemManagementPack.System);
ManagementPack mpSRLib = emg.ManagementPacks.GetManagementPack("ServiceManager.ServiceRequest.Library", mpSystem.KeyToken, new Version("7.5.1464.0"));
ManagementPack mpWorkItemLibrary = emg.ManagementPacks.GetManagementPack("System.WorkItem.Library", mpSystem.KeyToken, new Version("7.5.1464.0"));
ManagementPack mpActivityLib = emg.ManagementPacks.GetManagementPack("System.WorkItem.Activity.Library",mpSystem.KeyToken,new Version("7.5.1464.0"));
//Get the relationship and type projection we'll be using for this query
ManagementPackRelationship mprWIContainsActivity = mpActivityLib.GetRelationship("System.WorkItemContainsActivity");
ManagementPackTypeProjection mptpWIActivities = mpSRLib.GetTypeProjection("System.WorkItem.ServiceRequestAndActivityViewProjection");
//This is the work item (such as a service request) ID that we're looking for
String WorkItemID = "SR123";
//Setup the criteria. This will instruct service manager to "Get me the service request with ID SR123"
String strWICriteria = String.Format(@"
<Criteria xmlns=""http://Microsoft.EnterpriseManagement.Core.Criteria/"">
<Reference Id=""System.WorkItem.Library"" PublicKeyToken=""{0}"" Version=""{1}"" Alias=""WILib"" />
<Expression>
<SimpleExpression>
<ValueExpressionLeft>
<Property>$Target/Property[Type='WILib!System.WorkItem']/Id$</Property>
</ValueExpressionLeft>
<Operator>Equal</Operator>
<ValueExpressionRight>
<Value>" + WorkItemID + @"</Value>
</ValueExpressionRight>
</SimpleExpression>
</Expression>
</Criteria>
", mpWorkItemLibrary.KeyToken, mpWorkItemLibrary.Version.ToString());
//Build the projection criteria
ObjectProjectionCriteria opcWI = new ObjectProjectionCriteria(strWICriteria, mptpWIActivities,emg);
//Perform the query
IObjectProjectionReader<EnterpriseManagementObject> oprWIs = emg.EntityObjects.GetObjectProjectionReader<EnterpriseManagementObject>(opcWI,ObjectQueryOptions.Default);
//oprWIs contains all of the work items with ID "SR123" (and there will only be one work item with that ID)
//We loop through all the work items in the oprWIs collection
foreach (EnterpriseManagementObjectProjection emopWI in oprWIs)
//Next we loop through all of the activities contained by our work item, using the WorkItemContainsActivity relationship
//NOTE that these activities are in no particular order. You'll have to use the icpActivity.Object[null,"SequenceId"].Value to order them
foreach (IComposableProjection icpActivity in emopWI[mprWIContainsActivity.Target])
//Since activity status is an enumeration, we want to display it's displayname, not it's value (enumeration values are just GUIDs or other unique identifiers)
ManagementPackEnumeration status = (ManagementPackEnumeration)icpActivity.Object[null, "Status"].Value;
//For this little snippet, we're just outputting the activity ID and it's status
Console.WriteLine(icpActivity.Object[null,"Id"].Value + " " + status.DisplayName);
Regarding the rest of your post, I'm not sure what you meant when you said you wanted the "change of activity". Are you trying to display the time that an activity's status changed (stored in the activity's history records)?
Second, if you're displaying this information on some other custom portal, what is the purpose for the workflow?
A couple disclaimers: Use this code at your own risk, there are no guarantees, etc etc :) Second, I'm assuming you're on Service Manager 2012 RC at least (otherwise the "versions" in the code will need to be changed)
Are you new to the SCSM SDK? If so, this code snippet might seem overwhelming. I recommend reading the Service Manager blog to get an idea about how classes, objects, relationships, type projections, etc all work.
Here's a link to a post by Travis that uses the SDK..he also references a lot of the information necessary to best understand Service Manager's inner workings :)
http://blogs.technet.com/b/servicemanager/archive/2010/10/04/using-the-sdk-to-create-and-edit-objects-and-relationships-using-type-projections.aspx

Similar Messages

  • How to get the list of active devices in current wifi network?

    Hi All,
    I am going to a start a new Network based app. So please any one give me an idea on the below question.
    How to get the list of active devices in current wifi network?

    Nope I want the log-in user to retrieve its Group where he is belong. I have this following code
    strUsername = Request.getParameter("username").toLowerCase().trim()+"@dev.test.com.ph";
    strPassword = Request.getParameter("password").toLowerCase().trim();
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX);
    env.put(Context.PROVIDER_URL, MY_HOST);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL,strUsername);
    env.put(Context.SECURITY_CREDENTIALS, strPassword);
    // enable tracing
    env.put("com.sun.naming.ldap.trace.ber", System.err);
    // Create the initial context
    DirContext initCtx = new InitialDirContext(env);
    // Get the target context
    DirContext targetCtx = (DirContext)initCtx.lookup("");
    SearchControls constraints = new SearchControls();
    constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
    // Perform the search on the target context
    NamingEnumeration enum = targetCtx.search("","(userPrincipalName="+strUsername+")",constraints);
    javax.naming.directory.Attributes attrs;
    NameClassPair item;
    String[] attrIds = new String[]{"MemberOf"};
    // For each answer found, get its "Groups" attribute
    // If relative, resolve it relative to the target context
    // If not relative, resolve it relative to the initial context
    while (enum.hasMore()) {
    item = (NameClassPair)enum.next();
    Out.println(item);
    attrs = targetCtx.getAttributes(item.getName(), attrIds);
    Out.println(attrs + "<br>");
         initCtx.close();
    It returns all this string :
    {memberof=memberOf: CN=CMCanadaRD,OU=Groups / Teams,DC=dev,DC=test,DC=com,DC=ph, CN=iMngrCanadaRW,OU=Groups / Teams,DC=dev,DC=test,DC=com,DC=ph, CN=Domain Users,CN=Users,DC=dev,DC=test,DC=com,DC=ph, CN=Backup Operators,CN=Builtin,DC=dev,DC=test,DC=com,DC=ph, CN=Administrators,CN=Builtin,DC=dev,DC=test,DC=com,DC=ph}
    How can i retrieve the Group named CMCanadaRW and CMCanadaRD on the Attribute?
    Thanks

  • How to get the current request id in a running request?

    How to get the current request id in a running request?
    Thanks.

    Did you notice that there's a whole section on this forum dedicated to this topic, called E-Business Suite?
    C.

  • HELP!! How to get the position of active windows in the desktop

    How to get the position of active windows in the desktop

    You mean, active windows other than the program you're running, or windows the program puts there? And a real desktop (like where MyComputer is), or a desktop pane?

  • How to get the transport request for a particular standard text?

    Hi,
    i want to know, how we get the transport request which associated for standard text.
    Please note already the standard text is assigned to the TR using RSTXTRAN program.
    i have a std text. i want to find the related TR for that!
    rds,
    Siva.

    Refer the link. It might tellsa about attaching to transport request but using the way you can find also -
    Re: How To Transport STANDARD TEXTS??
    Regards,
    Amit
    Reward all helpful replies

  • How 2 get the path of a file Using jsp

    how 2 get the path of a file Using jsp
    i have tried getPath...but i'm geting the error
    The method getPath(String) is undefined for the type HttpServletRequest
    any idea how 2 get the path of a file

    You need ServletContext#getRealPath().
    API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)

  • How to get the form name which is used in standard tcode like me23n in sap

    how to get the form name which is used in standard tcode like me23n in sap
    Moderator message: four out of four threads locked, please read and understand the following before posting further:
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers]
    Edited by: Thomas Zloch on Nov 18, 2011 1:32 PM

    how to get the form name which is used in standard tcode like me23n in sap
    Moderator message: four out of four threads locked, please read and understand the following before posting further:
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers]
    Edited by: Thomas Zloch on Nov 18, 2011 1:32 PM

  • How to get the concurrent request id while running a concurrent program

    Hi All,
    I am working with oracle apps r12.
    I have created a custom report with some parameter. And i have created a parameter P_CONC_REQUEST_ID.
    And in the report i have used SRW.USER_EXIT('FND SRWEXIT'); in after report and SRW.USER_EXIT ('FND SRWINIT'); in before report trigger.
    when i ran the report from the application, I didnt get the conc request id in the parameter. It not passing the concurrent request id.
    Can any one tell me how to bring the concurrent request id.
    Thanks & regards
    Srikkanth
    Edited by: Srikkanth.M on Mar 14, 2012 1:56 PM

    Hi;
    FND_CONCURRENT_REQUESTS
    This table contains a complete history of all concurrent requests.
    FND_RUN_REQUESTS
    When a user submits a report set, this table stores information about
    the reports in the report set and the parameter values for each report.
    FND_CONC_REQUEST_ARGUMENTS
    This table records arguments passed by the concurrent manager to each program it starts running.
    FND_DUAL
    This table records when requests do not update database tables.
    FND_CONCURRENT_PROCESSES
    This table records information about Oracle Applications and operating system processes.
    FND_CONC_STAT_LIST
    This table collects runtime performance statistics for concurrent requests.
    FND_CONC_STAT_SUMMARY
    This table contains the concurrent program performance statistics generated by the Purge Concurrent Request and/or Manager Data program. The Purge concurrent Request and/or Manager Data program uses the data in FND_CONC_STAT_LIST to compute these
    Also see:
    concurrent request details
    Find history of concurrent request details
    How to determine the user who placed a certain concurrent request?
    Regard
    Helios

  • How to get the soap request for the particular operations in CRM

    Hi friends,
    We got the wsdl files of different modules from the crm(Oracle CRM on demand). We converted the wsdl files to java classes using axis1.4 wsdl2java tool.Now all create,update,download,lookup operations are implemented in java using the generated classes and they are working properly with the client stub.Now the problem is how can we get the soap request and response of particular operations that we submitted to CRM .The request and response should get by using java code.We are looking no tool for the soap request/response. We are working in Eclipse IDE.
    thanks in advance...

    Refer the link. It might tellsa about attaching to transport request but using the way you can find also -
    Re: How To Transport STANDARD TEXTS??
    Regards,
    Amit
    Reward all helpful replies

  • In SQL Loader based Concurrent Program, how to get the current request id

    Hi All,
    I am trying the following control file.
    OPTIONS ( SKIP = 1 , ERRORS = 0 )
    LOAD DATA
    INFILE *
    REPLACE INTO TABLE XXPA_ASSET_TRANS_INTERFACE
    FIELDS TERMINATED by ',' OPTIONALLY ENCLOSED BY'"'
    TRAILING NULLCOLS
         Project_Number
         ,Asset_Name
         ,Location_Country Constant USA
         ,request_id CHAR "fnd_global.conc_request_id"
    in request id column I am getting -1 ...
    Please lt me know how can i get the current request id in the request_id field.
    Thanks

    Hi
    To my knowledge, this can't be achieved with SQL*Loader concurrent programs. Depending on what You are using the request id, the options provided may be useful.
    I had a similar issue, requiring the use of user_id and login_id for who columns, and the solution applied was:
    - Define a template for the control file, with place holders for the additional info:
    user_id constant "x_user_id"
    - Create a shell to receive the additional info as parameters, and use sed to change the template file to generate the control file, using the parameter to replace placeholders.
    Create a request set to launch the shell concurrent program and then the sql loader program, whose control file now has the additional information required.
    Caution when more than one middle tier node is used.

  • How to get the page request parameters in Command Button code

    Hi everyone,
    I am new to JSF and working on some Command Buttons. I put my java code via Edit Event, it works fine. But I don't know how to get some parameters from HttpServletRequest.
    Can anyone give some guidance? It would be much appreciated.
    Mike

    Thanks a lot for your tip. Unfortunately I could not open the link you provided due to some network issue.
    Yes, I intend to get some parameters from URL. I did try to put your code and get the parameters predefined in the URL, however I got the null returned. By the way, I put the following code in the page source part and it works. Just don't know how to get the value being passed to the command button event code.
    <%
    String userID = request.getParameter("u");
    System.out.println("this is from head - the userID is :: " + userID);
    %>
    Thanks again and hope you could give me further advice.

  • How to get the spool request number ?

    Hi All,
    I am working on a smart-forms. I am using a custom transaction to print these smartforms. When I execute
    the transaction the print screen comes where I can do
    print preview or print.
    Now to convert this Smart Form to PDF I need to know the spool request number to use in the report called RSTXPDFT5.
    How do I get the spool request number ?
    Do I need to do some changes in spool control options of print screens to get the spool request number or something else ?
    Please let me know.
    Answers will be awarded...
    Tushar

    Hi,
    You will get the spool no. in the parameter "job_output_info" after calling the smartform function module in print program. The spool ids of the prints is stored in table job_output_info-SPOOLIDS.
    Regards,
    Gagan

  • How o get the SOAP request from webmethod?

    Hi,
    I want to get the full request (what i sent from client application) on the @webmethod of my webservice.
    Immediately i want to forwward the same request to another application which is ready to receive as HttpRequest.
    How could i do that?

    Hi,
    Thanks for the reply.
    I tried the code in my application, but it always throws NullPointerException
    while executing this line,
    MessageContext msgCtxt = wsContext.getMessageContext();
    My code is,
    @WebService(name = "FirstService")
    @SOAPBinding
    style = SOAPBinding.Style.DOCUMENT,
    use = SOAPBinding.Use.LITERAL,
    parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
    public class MyFirstService
         WebServiceContext wsContext;
         @WebMethod
         public void getMehod()
              try
                   System.out.println("1");
                   MessageContext msgCtxt = wsContext.getMessageContext();
                   System.out.println("2");
                   HttpServletRequest req = (HttpServletRequest)msgCtxt.get(MessageContext.SERVLET_REQUEST);
                   System.out.println("3");
                   System.out.println("REQUEST = " + req.toString());
              catch(Exception e)
                   System.out.println("Exception : " + e.toString());
    If i call this method from SoapUI,
    the output is,
    INFO [STDOUT] 1
    INFO [STDOUT] Exception : java.lang.NullPointerException
    I don't know where i did the mistake...
    Waiting for your reply

  • How to get the URL of an iView using AbstractPortalComponent

    Hi All,
    I need to get the URL of an iView using AbstractPortalComponent using the following code.
    But i am unable to open the URL from the Browser
    This is the following code snippet
    public class AbsClass extends AbstractPortalComponent
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    IPortalComponentURI componentURI = request.createPortalComponentURI();
    componentURI.setContextName("pcd:portal_content/LOG_Viewer/LogViewer");
    String URI=componentURI.toString();
    response.write(URI);
    The output i got from the browser is:
    /irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fLOG_Viewer!2fLogViewer
    Actual Path: pcd:portal_content/LOG_Viewer/LogViewer
    Output Path: /irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fLOG_Viewer!2fLogViewer
    Why some extra numerics are embeded in the output path when compare with the Actual Path.
    Can any one send me the modified code and your suggestions, how to achieve this problem.
    Regards
    Phani

    Hi,
    Now i need to get the URL of this component.
    IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    IPortalComponentURI componentURI = request.createPortalComponentURi();
    componentURI.setContextName("com.sap.portal.appintegrator.sap.bwc.Transaction");
    String URI=componentURI.toString();
    response.write(URI);
    I export this component into Portal and i tested with an iView based on this par file, i got the URL in the Preview.
    But when i tried to run this URL by adding the http://<IPADDRESS>:<PORTNO>+URL
    I am facing one AccessDenied Exception for this Object. ( USER/GUEST)
    Is there any security zone, or other Permissions Problem, if so can you plz guide me what are the settings i have to change inorder to resolve this exception
    Regards
    Phani

  • How to get the values of an Array using JSP Tags

    Hey guys,
    I need some help. I've splited a String using
    fn:split(String, delim) where String = "1,2,3,4" and delim is ,
    This method returns an Array of splited Strings. how do i get the values from this array using jsp tags. I don't wanna put java code to achive that.
    Any help would be highly appreciated
    Thanks

    The JSTL forEach tag.
    In fact if all you want to do is iterate over the comma separated list, the forEach tag supports that without having to use the split function.
    <c:set var="list" value="1,2,3,4"/>
    <c:forEach var="num" items="${list}">
      <c:out value="${num}"/>
    </c:forEach>The c:forTokens method will let you do this with delimiters other than a comma, but the forEach tag works well just with the comma-delimited string.

Maybe you are looking for

  • Confusion on EO and EOIO..

    Hi, in sender file ( FTP ) adapter: when qos :eoio the sequence the msg processess will be in ascending alphabetical order. ex: if i have 10 files in a folder as per the my requirement all the 10 files are picked up at the same time, then the files w

  • Téléchargement appli. CC impossible

    Nouvel abonné, lorsque je clique sur le lien "téléchargement", rien ne se produit. Merci de votre aide.

  • OSB architecture and different control paths

    Hello, reading docs seems to be that control-path to library ( others back sfw normally managed by the backup server ) that admin server manages is only on tcp-ip ( mount commands to library goes through management network ) ..the same on best practi

  • Help with UDF

    Hi, I would like to send a email using UDF. Requirement: if xyz == "9" then send a email and also pass the value .......                       else directly pass the value I want to do it without Looksups, exclusively using Java code inside UDF. has

  • Page Not Found error for Creative Cloud - After sign in

    Today, after sign in I got message on home page ( Files section) 'Page Not found- Sorry, we couldnt find that page'. I have all my valuable data, but can not see anything now. Till yesterday I worked with CC, wiythout any issue. Worried about all my