Skip to Content

How to attach form template in a Service Ticket in C4C Via SDK

Hi Experts,

I have urgent requirement to add a PDF Template in attachment of Service ticket via SDK

Can anyone suggest me how to add a PDF template in attachment of service ticket via SDK , Please suggest me your valuable suggestion.

Please suggest me ASAP.

ThankYou.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 07, 2017 at 04:54 PM

    Hi,

    Here is answer.....

    First we need to be able register a template Service Ticket in C4C. For this we can create a Document Type. Since we cannot authorize on these document types you might need to use a code list restriction to prevent end users from creating Service Ticket of this type, and only let for instance key users create and update templates.


    The coping of the template to the ticket will be done with an SDK Action, in order to trigger this Action we will implement a Workflow. In this case the template needs to be copied after we have filled in the Resolution Category in the Ticket.

    For details on how to create an action in de SDK The action that we require will consist of two parts, First we need to find the template and then we need to copy the contents of the template to the current ticket.

    Querying for the templates can be done with this code snippet:

    //Query Template Service Requests var query = ServiceRequest.QueryByElements; var selectionParams = query.CreateSelectionParams(); selectionParams.Add(query.ProcessingTypeCode, "I","EQ","ZABU"); selectionParams.Add(query.ServiceIssueCategoryMainActivityCategoryKey.ServiceIssueCategoryID.content,"I","EQ", catkeyid); var resultData = query.ExecuteDataOnly(selectionParams); ticket = resultData.GetFirst(); if (ticket.IsInitial() == false ) { var template = ServiceRequest.Retrieve(ticket.UUID); foreach (var tempitem in template.Item ) { if (tempitem.ItemProduct.IsSet() ) { prodid = tempitem.ItemProduct.ProductInternalID; } } }
    Adding products to the current can be done with this code snippet:
    //Add Product to Ticket. var lineID = 10; foreach (var tempitem in template.Item ) { if (tempitem.ItemProduct.IsSet() ) { prodid = tempitem.ItemProduct.ProductInternalID; if ( prodid.IsInitial() == false ) { servitem.ID =lineID.ToString(); servitem.UserServiceTransactionProcessingTypeCode = "Z001"; var institem = this.Item.Create(servitem); var quantity = 1; if (! institem.ItemProduct.IsSet()) { proditem.ProductKey.ProductID.content = prodid.content; institem.ItemProduct.Create(proditem); } else { institem.ItemProduct.ProductKey.ProductID.content = prodid.content; } if (! institem.FirstRequestedItemScheduleLine.IsSet()) { scheditem.Quantity.content = 1; institem.FirstRequestedItemScheduleLine.Create(scheditem); } else { institem.FirstRequestedItemScheduleLine.Quantity.content = 1; } lineID = lineID + 10; } }
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 21, 2017 at 12:49 PM

    Thank You Keshav

    Sorry for the late response I will try this now actually this task has been done by my other team member.

    I will try for myself now.

    Thank you again

    Avinash Sunder

    Add comment
    10|10000 characters needed characters exceeded