cancel
Showing results for 
Search instead for 
Did you mean: 

how to update service request ticket during activity creation?

sivakrishna_boddapati
Participant
0 Kudos
1,091

Hi Experts,

Through email channel service requests or tickets are created in C4C and we want to capture the email address of the customer who is sending the request. The logic has been written in before saving and it is working as expected.

this.ZKUT.Email = this.PrecedingEmailActivityReference.EmailActivity.MessageFromParty.EmailURI;

Now we are replying to a customer from C4C with the ticked ID in the email subject.

For the same ticket, we receive a reply from a different email address.

In C4C, an activity is created and it is displayed in interactions of same service request but the docflow is not updated with new activity. For that ticket.

Now my question is how to update a Service Request or ticket while the "Activity" is saved.

From the email subject line, I am able to see the Service ticket number during activity saving.

Please advise.

Thanks & regards,

Siva Krishna

Accepted Solutions (1)

Accepted Solutions (1)

Stefan_Neumann
Explorer

Dear Siva,

i had the same issue once. The problem is, that only the first mail ist linked to the ticket via DocumentReference. The following mails wont be. Therefore you need to check those in the activity before save, write the data you want to change into a custom BO and connect this custom BO with an internal communication to the service request standard BO.
The code snippet from the activty before save:

foreach (var inst in this)
{
       if (!inst.InitiatingActivityUUID.IsInitial() && inst.InitiatorCode == "2")
	{
		var queryActivity = Activity.QueryByElements;
		var queryActivityParams = queryActivity.CreateSelectionParams();
		queryActivityParams.Add(queryActivity.InitiatingActivityUUID, "I", "EQ", inst.InitiatingActivityUUID);
		var queryActivityResults = queryActivity.Execute(queryActivityParams).OrderByDescending(n => n.SystemAdministrativeData.CreationDateTime);
		if (queryActivityResults.GetLast().IsSet())
		{
			var queryServiceRequest = ServiceRequest.QueryByElements;
			var queryServiceRequestParams = queryServiceRequest.CreateSelectionParams();
			queryServiceRequestParams.Add(queryServiceRequest.BusinessTransactionDocumentReferenceBusinessTransactionDocumentReferenceID.content, "I", "EQ", queryActivityResults.GetLast().ID);
			var resultsServiceRequest = queryServiceRequest.ExecuteDataOnly(queryServiceRequestParams);
			if (!resultsServiceRequest.GetLast().IsInitial())
			{
				var ticketID = resultsServiceRequest.GetLast().ID;
				var retrieveUpdateActivity = BO_ActivityTicketUpdate.Retrieve(ticketID);
				if (retrieveUpdateActivity.IsSet())
				{						
					var mfParty = inst.MessageFromParty;
					if (mfParty.IsSet())
					{
						retrieveUpdateActivity.emailSender = mfParty.EmailURI;
					}									
				}
				else
				{
					var activityTicketCreatedElements : elementsof BO_ActivityTicketUpdate;
					activityTicketCreatedElements.TicketID.content = ticketID.content;
					var mfParty = inst.MessageFromParty;
					if (mfParty.IsSet())
					{
						activityTicketCreatedElements.emailSender = mfParty.EmailURI;
					}						
					var activityTicketCreated = BO_ActivityTicketUpdate.Create(activityTicketCreatedElements);
				}
			}
		}
	}
}	

The CBO:

The internal communication:

I hope this will help.

Best Regards

Stefan Neumann

Answers (2)

Answers (2)

sivakrishna_boddapati
Participant
0 Kudos

Hi Stefan Neumann,

where can we check cardinality relation ship between custom BO and service request BO?

I am trying to delete entry in custom BO Event BeforeSave.ABSL using below code but it is deleting entry of service request.

why I am getting reference of service request BO in custom BO? I have used below code to delete entry of custom BO.

Event-BeforeSave.absl of BO_ActivityTicketUpdate

import ABSL;

this.Delete( ); ----> this is getting service request BO reference instead of custom BO root reference.

Please provide your inputs, Thank you.

Thanks & Regards,

Siva Krishna

sivakrishna_boddapati
Participant
0 Kudos

Hi Stefan Neumann,

Thank you very much for your response and it is very helpful. Do I need to clear the entries in my custom BO or will it automatically delete entries from my custom BO once the Activity BO save has been completed?

Thanks,

Siva Krishna

Stefan_Neumann
Explorer
0 Kudos

Dear Siva Krishna,

the entries wont be deleted automatically after the asynchron sending is done, if you need that for data privacy you need to develop it yourself. Probably a Mass Data Run on the CBO and a creation date to refer to for the deletion process.

Best Regards

Stefan Neumann