Desktop and UI Extensibility

Get Involved. Join the Conversation.

Topic

    Lakshay Bhalla
    Desktop Add-in to create a new Incident on Button Click.
    Topic posted June 17, 2019 by Lakshay BhallaGold Trophy: 10,000+ Points 
    32 Views, 4 Comments
    Title:
    Desktop Add-in to create a new Incident on Button Click.
    Summary:
    Desktop Add-in to create a new Incident on Button Click.
    Content:

    Hi All,

    I am new to Desktop Add-in Development. I am trying to create a Workspace Ribbon add-in which when clicked shows a Assign to another agent type of pop up (screenshot 1.png). When the user clicks on the Ok button after selecting the agent, a new incident is created with the same incident info as the previous incident and the newly created incident is associated to the previous incident as the child incident. I don't have the workflows in my site otherwise this whole task would have been easy. If possible can anyone share any Code sample for reference.

    Thanks

    -Lakshay

    Version:
    Oracle service cloud version 19A and customer portal framework v3.4
    Image:

    Comment

     

    • Deepu Kolkkadan

      Hi Lakshay,

      Below is the sample .net code for creating new Incident, as per your requirement first you need to create a workspace ribbon addin, you will get that code from OSC  addIn documentation. From IRecordcontext you will get current Incident field values, you can assign these values to new incident. To use below code you should add OSC SOAP API to your addIn module.

       

      public void createContactIncidentSample()
      {
          //Create a Contact and Incident object
          Contact newContact = new Contact();
          Incident newIncident = new Incident();
           
          //Create an API access request header    
          APIAccessRequestHeader aPIAccessRequestHeader = new APIAccessRequestHeader();
           
          //Build a PersonName object for the Contact
          PersonName personName = new PersonName();
          personName.setFirst("Jane");
          personName.setLast("Smith");
           
          //Build an E-MailList object
          EmailList emailList = new EmailList();
           
          //Build the Email array, here we populate a single e-mail address
          Email[] emailArray = new Email[1];
          emailArray[0] = new Email();
      • Lakshay Bhalla

        Hi Deepu,

        Thank you for replying. 

        But this code is not solving the purpose because It's just creating a new incident, whereas i have to Create the incident from an already present incident ,i.e., i have to copy all the field values except the Assigned value because that i will be passing through the Drop-down.

    • Deepu Kolkkadan

      Hi Lakshay,
      I mentioned that you will get current incident field values from incident 'RecordContext'. Please look in to below code in that I am fetching  product and category  field values. Similar like you can fetch all standard and custom fields, then while creating new incident assign these values to that incident object except assigned field value.

       

      IIncident incident = (IIncident)RecordContext.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident);
                      categoryID = incident.CategoryID.ToString();
                      productID = incident.ProductID.ToString();

       

      Thanks,

      Deepu

      • Lakshay Bhalla

        Okay now it clear because it looked like the code and the IRecordContext were unrelated. Now that you have posted an example of use of IRecordContext, It is clear now.

        Thanks