cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

former_member87164
Active Contributor
0 Kudos

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; } }