Hi Experts,
I am creating an Email Activity with the type code "39" in the Before Save script file of Activity while saving the Activity Task(TypeCode: 542).
But i am getting the following errors with the standard code which sap has given in the repository explorer for Email Activity Creation..!!
these are the errors:
Please enter a process type.
Save failed. Technical error due to object ID not determined. Please report an incident.
Identity is invalid or could not be determined. Please check.
Date is invalid or could not be determined. Please check.
Save failed..
Why is that i am getting these errors?? i used the code which is there in the 1402 repository explorer..
Thanks,
Mani
Hi Mani,
the problem was solved with the following workaround! Is working fine 😊
Please check:
How to generate an email instance inside the new 1402 Activity BO - Workaround
In 1402 Cloud for Customer we re-architected the activity BO backend to make it more lean and simple. You will notice there are 2 "activity" BOs in the repository explorer, one that has been "deprecated" and the other "active". I have a working sample using the sample provided in the repository explorer to create activity tasks via a custom action. What I noticed is that if you don't reference the right "activity" you will inadvertently write code that will reference the deprecated activity. Your code will activate, but will not work. Once I referenced the right "activity" and then corrected the code (the new activity BO structure is different so the type-ahead code completion results are different) everything worked correctly.
As an FYI, pre 1402 ABSL code and UI designer configuration for any activity related SDK work (emails, tasks, appointments, phone calls) will need to go through this refactoring to use the new activity BO. The old activity BO is deprecated and custom business logic/custom UI referencing this old activity BO will not work anymore in 1402.
Here is my sample
/*
Add your scripting language implementation for:
Business Object: ServiceContract
Node: Root
Action: CreateActivityTask
Note:
- To access the elements of the business object node,
use path expressions, for example, this.<element name>.
- To use code completion, press CTRL+J.
*/
import ABSL;
import AP.PC.ActivityManagement.Global;
//Activity: Root node
var elActivityRoot : elementsof Activity;
var instActivity;
// Activity: define party node
var elActivityParty : elementsof Activity.Party;
var instParty;
// Activity: define text collection
var elActivityTxtCollTxt: elementsof Activity.TextCollection.Text;
var elActivityTxtCollTxtCntnt: elementsof Activity.TextCollection.Text.TextContent;
var instActivityTxtColl;
var instActivityTxtCollTxt;
// Activity: define attachment folder
var elActivityAttachmDoc: elementsof Activity.AttachmentFolder.Document;
var instActivityAttachm;
// Activity: maintain Business Object type - mandatory (12 = Appointment; 39 = Email; 86 = Phonecall; 542 = Task)
elActivityRoot.TypeCode = "542"; // create Task
// Activity: maintain description - mandatory
elActivityRoot.SubjectName = "Task created for Contract";
elActivityRoot.ServiceContractIDForActivity = this.ServiceContractID;
// Activity: create new instance
instActivity = Activity.Create(elActivityRoot);
/*
// Activity: Organizer party - mandatory
if (! instActivity.OrganizerParty.IsSet()) {
// supply party either with ID: MC2471 or Name: Kate Jacob or Email: Kate.Jacob@silverstar.us, etc.
elActivityParty.PartyName = "MC2471";
instActivity.OrganizerParty.Create(elActivityParty);
}
// Activity: Attendee party - optional
elActivityParty.PartyName = "MCPC9785";
instActivity.AttendeeParty.Create(elActivityParty);
*/
// Activity: Set Employee Responsible (optional, because party determination applies rules for automatic determination)
if (! instActivity.EmployeeResponsibleParty.IsSet()) {
elActivityParty.PartyName = this.EmployeeResponsibleID;
instActivity.EmployeeResponsibleParty.Create(elActivityParty);
}
if (! instActivity.MainActivityParty.IsSet()) {
elActivityParty.PartyName = this.CustomerID;
instActivity.MainActivityParty.Create(elActivityParty);
}
if (! instActivity.MainContactParty.IsSet()) {
elActivityParty.PartyName = this.ContactID;
instActivity.MainContactParty.Create(elActivityParty);
}
// Activity: set start and end time
instActivity.ScheduledStartDateTime.content = GlobalDateTime.ParseFromString("2014-01-14T13:30:00Z");
instActivity.ScheduledEndDateTime.content = this.EndDate.ConvertToGlobalDateTime();
//GlobalDateTime.ParseFromString("2014-01-14T15:00:00Z");
// Create a text of type "Body Text"
instActivityTxtColl = instActivity.TextCollection.Create();
elActivityTxtCollTxt.TypeCode.content = "10002";
instActivityTxtCollTxt = instActivityTxtColl.Text.Create(elActivityTxtCollTxt);
elActivityTxtCollTxtCntnt.Text.content = "Body text of the Activity Appointment";
instActivityTxtCollTxt.TextContent.Create(elActivityTxtCollTxtCntnt);
// Create an attachment of type "Link"
instActivityAttachm = instActivity.AttachmentFolder.Create();
elActivityAttachmDoc.Description.content = "PDI Comment for Attachment";
elActivityAttachmDoc.CategoryCode = "3";
elActivityAttachmDoc.Name = "SAP";
elActivityAttachmDoc.AlternativeName = "SAP Homepage";
elActivityAttachmDoc.ExternalLinkWebURI = "http://www.sap.com";
instActivityAttachm.Document.Create(elActivityAttachmDoc);
Add a comment