cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create ticket for all the unassociated email in C4C

former_member15983
Participant
0 Kudos
2,293

Hi SDK Experts,

Need help on addressing this issue

Requirement:

When an Unassociated e-mails created in C4C system, we want to convert that email to ticket Via SDK, instead of manually exectuing the action - Convert to Ticket.I found that there is a standard method CreateWithReference in the ServiceRequest BO and tried to execute the below function at before save event of Activity BO.

var ticket = ServiceRequest.CreateWithReference(email,"SRRQ");

but i get an error "Access of member 'CreateWithReference' in a cross-deployment unit is not possible."

This is a show stopper for our project to go live.

Any inputs will be helpful, Please help!!

I want to tag

Accepted Solutions (0)

Answers (5)

Answers (5)

Hi Prem

Activity BO is in Foundation deployment Unit and ServiceRequest BO is in CustomerRelationshipManagement deployment unit. Modifying data from one DU to other is not allowed.

You can use internal communication or internal web service to handle this.

Regards

Praveen

Gayatri_Bagde
Active Participant

Hi,

Instead of using SDK to convert all unassociated emails to Ticket, you can directly use "Default Account" field in E-mail channel setup so that whenever an email comes from unknown senders, the ticket will be created in the system with the default account mentioned.

Thanks,

Gayatri

dominik_g
Participant
0 Kudos

Hi DevC4C009

you could try to add the business document reference of the Email in Before save of ServiceRequest.BusinessTransactionDocumentReference.

import ABSL;
import AP.Common.GDT;
import AP.PC.ActivityManagement.Global;
import AP.PDI.bo;

var qryActivity = Activity.QueryByElements;
var qryActivityParam = qryActivity.CreateSelectionParams();

foreach(var obj in this) {
	if(obj.BusinessTransactionDocumentReference.TypeCode == "39") { //39 = Email
		if(obj.BusinessTransactionDocumentReference.UUID.content.IsInitial() && !obj.BusinessTransactionDocumentReference.ID.content.IsInitial()) {
			qryActivityParam.Clear();
			qryActivityParam.Add(qryActivity.TypeCode, "I", "EQ", obj.BusinessTransactionDocumentReference.TypeCode + "");
			qryActivityParam.Add(qryActivity.ID, "I", "EQ", obj.BusinessTransactionDocumentReference.ID.content.RemoveLeadingZeros());
			var qryActivityResult = qryActivity.ExecuteDataOnly(qryActivityParam);
			foreach(var activity in qryActivityResult) {
				obj.BusinessTransactionDocumentReference.UUID.content = activity.UUID;
				break;
			}
		}
	}
}

 

I don't have access to the source code anymore, but this is what I can remember so far.

And in Activity.BeforeSave you may need to set the SAP Standard field InitiatingActivityUUID with the ServiceRequestID when the ticket is created as far as I can remember it.

import ABSL;
import AP.Common.GDT as apCommonGDT;
import AP.PC.ActivityManagement.Global;
import AP.PDI.bo;


foreach(var obj in this) {

	var relevant = false;
	if(obj.TypeCode == "39") { //39 = E-Mail
	
		// Fill InitiatingActivityUUID so that the Email is also visible in the list view of the ticket
		if(!obj.ZZ_ServiceRequestID.content.IsInitial()) {
			if(obj.InitiatingActivityUUID.IsInitial()) {
				obj.InitiatingActivityUUID = obj.UUID;
			}
		}
	}
}

 

ravi_a3
Participant
0 Kudos

@premkumar.ms,

How did you solve this scenario? We are looking for this in our project to implement. How did you achieve it?

Thanks,
Ravi

dominik_g
Participant

ravi.a3 we had a similar implementation scenario. We used the default web service manageServiceRequestIn to create a new ticket based on information sent in the unassociated email.

  • Emails are instances of the BusinessObject Activity,
  • those activities have the TypeCode 39 (39= E-Mail) und GroupCode 0004 (0004 = Business E-Mail), with a filled ActivityFollowUpServiceRequestBlockingReasonCode (=this field is only filled on not assigned emails) und InitiatorCode = 2 (2= Inbound, 3 = Outbound)
  • the body of the email can be found in the TextCollection Text element with TextTypeCode 10002 (10002 = Body Text)

After Activity creation, a custom business object is created via an Internal Communication.

first web service call: Create ticket (SOAP Request)

var manageTicketRequest : ManageServiceRequestIn_PROD.MaintainBundle.Request;
var manageServiceRequest : ManageServiceRequestIn_PROD.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest;
var manageServiceRequestBtdRef : ManageServiceRequestIn_PROD.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.BusinessTransactionDocumentReference;
manageServiceRequest.businessTransactionDocumentReferenceListCompleteTransmissionIndicator = true;
manageServiceRequest.actionCode = "04";
manageServiceRequest.DataOriginTypeCode = "5"; //5 = E-Mail
manageServiceRequest.Name = activity.SubjectName;
manageServiceRequest.BuyerParty.BusinessPartnerInternalID = contactPersonSoldToPartyMapping.SoldToPartyID;
manageServiceRequest.BuyerParty.MainContactParty.BusinessPartnerInternalID = contactPersonSoldToPartyMapping.ContactPersonID;
contactPersonID = manageServiceRequest.BuyerParty.MainContactParty.BusinessPartnerInternalID;
manageServiceRequest.textListCompleteTransmissionIndicator = true;
manageServiceRequestBtdRef.actionCode = "04";
manageServiceRequestBtdRef.BusinessTransactionDocumentRelationshipRoleCode = "1"; //1 = Predecessor
manageServiceRequestBtdRef.BusinessTransactionDocumentReferenceID.content = activity.ID.RemoveLeadingZeros();
manageServiceRequestBtdRef.BusinessTransactionDocumentReferenceTypeCode.content = "39"; //39 = E-Mail
manageServiceRequest.BusinessTransactionDocumentReference.Add(manageServiceRequestBtdRef);
manageTicketRequest.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.Add(manageServiceRequest);
var manageTicketResponse = ManageServiceRequestIn_PROD.MaintainBundle(manageTicketRequest, "", "CS_UEE_TicketIn_PROD");
if (!manageTicketResponse.ServiceRequestBundleMaintainConfirmation2_sync.Log.MaximumLogItemSeverityCode.IsInitial() && manageTicketResponse.ServiceRequestBundleMaintainConfirmation2_sync.Log.MaximumLogItemSeverityCode == "3")
{
	webserviceRequestError = true;
	
}
else if (!manageTicketResponse.CommunicationFault.MaximumLogItemSeverityCode.IsInitial() && manageTicketResponse.CommunicationFault.MaximumLogItemSeverityCode == "3")
{
	webserviceRequestError = true;
	
}
else {
	foreach(var serviceRequestResponse in manageTicketResponse.ServiceRequestBundleMaintainConfirmation2_sync.ServiceRequest) {
		if(!serviceRequestResponse.ID.content.IsInitial()) {
			serviceRequestID.content = serviceRequestResponse.ID.content;
			serviceRequestUUID.content = ABSL:UUID.ParseFromString(serviceRequestResponse.UUID.content);
			ticketCreated = true;
			break;
		}
	}
}

Second web service call to update email activitity (clear ActivityFollowUpServiceRequestBlockingReasonCode so that the email is not unassocaited anymore)

var body = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:glob=\"http://sap.com/xi/SAPGlobal20/Global\">"
+"<soap:Header/>"
	+"<soap:Body>"
		+"<glob:EmailActivityBundleMaintainRequest_sync_V1>"
			+"<EmailActivity actionCode=\"04\" businessTransactionDocumentReferenceListCompleteTransmissionIndicator=\"true\">"
				+"<ID>"+activity.ID.RemoveLeadingZeros()+"</ID>"
				+"<LifeCycleStatusCode>"+activityLifeCycleStatusCode+"</LifeCycleStatusCode>"
				+"<ActivityFollowUpServiceRequestBlockingReasonCode>"+activityFollowUpServiceRequestBlockingReasonCode+"</ActivityFollowUpServiceRequestBlockingReasonCode>"
				+"<BusinessTransactionDocumentReference actionCode=\"04\">"
				  +"<ID>"+serviceRequestID.content.RemoveLeadingZeros()+"</ID>"
				   +"<TypeCode>118</TypeCode>" //118 = Ticket
				   +"<RoleCode>2</RoleCode>" //2 = Successor
				+"</BusinessTransactionDocumentReference>"
				+"<MessageFromParty/>"
			+"</EmailActivity>"
		+"</glob:EmailActivityBundleMaintainRequest_sync_V1>"
	+"</soap:Body>"
+"</soap:Envelope>";

dominik_g
Participant

hope this helps 🙂

former_member15983
Participant
0 Kudos

Hi ravi.a3

We created an account with the name "Account update Required" and add this account as a default to the Email addresses communication channel.

So all the emails will first look for an account based on the sender email in any of that account's contact and update the account and if it couldn't find any corresponding account then it will update the account with the default "Account update Required". CSR will look at and create a prospect account or add that email to an existing account and proceed further. Hope this helps.

Thanks,

Prem.

0 Kudos

dominik.g,

our requirement : once a ticket is closed and customer try to reply on the same closed ticket via outlook,then the email gets into unassociated email.Which is a standard functionality but we want to convert that unassociated email into ticket via SDK.

Analysis done so far : My approach was to read the ID of unassociated email and using that link create a ticket via SDK by creating internal communication and in the custom bo of internal communication,i am unable to capture the ID(the mail sent by customer on the closed ticket via outlook/gmail) of unassociated email.

could you please help us with the approach?

DevC4C009
Discoverer
0 Kudos
We have implemented the same solution but we are facing an issue, unable to link inbound email to the newly created ticket. Were you able to link email with ticket so that email is visible in timeline view in ticket? If yes, please provide some pointers to show inbound email in the ticket also
dominik_g
Participant
0 Kudos
DevC4C009
former_member15983
Participant
0 Kudos

Hi Gayatri

Though we maintain the default account, we see that email is going to Unassociated email and not to the default account. We have raised this with SAP , meanwhile we are trying to address the issue using SDK.

Thanks,

Prem.

tushargoel519
Participant
0 Kudos

Hi Prem Muthuswamy,

Can you please help me in the scenario you had mentioned , I also need some lights on this as the same requirement becomes show stopper for the project am working on.

Thanks,

Tushar Goel